[R] Convert character vector into string

Ista Zahn istazahn at gmail.com
Thu Apr 29 05:35:40 CEST 2010


Hi Ian,

I would use paste() for this:

> x <- c("a","b","c")
> x.s <- paste(x, collapse=" ")
> x.s
[1] "a b c"

-Ista

On Thu, Apr 29, 2010 at 4:21 AM, Ian Seow <ianseow at gmail.com> wrote:
> Hi, how do I convert a character vector into a string?
>
> c("a","b","c")  into "a b c"
>
> Thanks!
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>



-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org



More information about the R-help mailing list