Dear All, When I have a numeric vector, I want to change it to one character value. For example, When I have test <- c(4, 5, 3, 2) I want to change it to "4 5 3 2"(one character value) How can I get it? Thanks in advance, Soyeon
Phil Spector
2010-Dec-03 20:10 UTC
[R] How to change a numeric vector to a character value
t <- c(4, 5, 3, 2)> paste(test,collapse=' ')[1] "4 5 3 2" - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spector at stat.berkeley.edu On Fri, 3 Dec 2010, Soyeon Kim wrote:> Dear All, > When I have a numeric vector, I want to change it to one character value. > For example, > When I have > test <- c(4, 5, 3, 2) > I want to change it to "4 5 3 2"(one character value) > > How can I get it? > > Thanks in advance, > Soyeon > > ______________________________________________ > 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. >