[R] How does one do simple string concatenation?

Romain Francois rfrancois at mango-solutions.com
Mon Mar 17 11:58:18 CET 2008


Hi,

See collapse argument in ?paste

R> paste( paste(c("a","b","c"), collapse = ""), "d", sep = "")
[1] "abcd"

Cheers,
Romain

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"
>   
-- 
Mango Solutions
data analysis that delivers

Tel:  +44(0) 1249 76 77 00
Fax:  +44(0) 1249 76 77 07
Mob:  +44(0) 7813 52 61 23



More information about the R-help mailing list