I'm trying to separate each of the values in a list with a comma. For example, instead of 'item1''item2', I am looking for 'item1','item2'.
Here is what I am working with:
combos <- lapply(2:4, function(x) combn(c("item1","item2","item3","item4"), x, simplify = FALSE))
combos <- unlist(combos, recursive = FALSE)
Thank you!
CodePudding user response:
We loop over the list
with lapply
and paste
with toString
lapply(combos, toString)