I would like to convert a named list of characters like
stringlist = list("list1" = list("a","b",c("a","b")),
"list2" = list("c","d",c("c","d")))
into a character vector
[1] "a" "b" "ab" "c" "d" "cd"
where the list objects of length > 1 are combined into a single element in the resulting character vector. The solution from this thread is
sapply(stringlist, paste0, collapse="")
which returns
list1 list2
"abc(\"a\", \"b\")" "cdc(\"c\", \"d\")"
so I was wondering whether there is an elegant and short solution to this problem.