Cristian Montes wrote:
Ok, sorry, I misinterpreted the question!  Here is the right solution

x <- c("a", "b", "c", "d", "e")
z <- x[1]

for (i in 2:length(x))
    {
     z<- paste(z, x[i], sep = "+")
    }

print(z)

[1] "a+b+c+d+e"


Or

paste(x, collapse = '+')

which was the solution that was in the message you originally replied to.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to