[R] How does one do simple string concatenation?

Gabor Csardi csardi at rmki.kfki.hu
Mon Mar 17 12:03:05 CET 2008


First 'c' and then 'paste' with 'collapse':

paste(collapse="", c(c("a", "b", "c"), "d"))

See ?paste

G.

On Mon, Mar 17, 2008 at 04:26:17PM +0530, Ajay Shah wrote:
> How does one convert objects c("a","b","c") and "d" into "abcd"?
> 
>    > paste(c("a","b","c"), "d")
> of course yields
>    [1] "a d" "b d" "c d"
> 
> -- 
> Ajay Shah                                      http://www.mayin.org/ajayshah  
> ajayshah at mayin.org                             http://ajayshahblog.blogspot.com
> <*(:-? - wizard who doesn't know the answer.
> 
> ______________________________________________
> R-help at 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.

-- 
Csardi Gabor <csardi at rmki.kfki.hu>    UNIL DGM



More information about the R-help mailing list