Displaying 1 result from an estimated 1 matches for "collaplse".
Did you mean:
colapse
2009 Apr 01
1
paste to collapse vector to string
Hi,
I'm trying to collapse a character vector to strings, but I am getting
unexpected behaviors in list context:
A <- "a"
B <- c("b","c")
xx <- list(A=A, B=B)
lapply(xx, paste, collaplse=".")
$A
[1] "a ."
$B
[1] "b ." "c ."
paste(B, collapse=".")
[1] "b.c" # this is what I want
paste(A, collapse=".")
[1] "a" # this is what I want
Why does the list context give me back vectors? Am I mi...