Jerry Pressnell
2006-Apr-25 06:17 UTC
[R] Add qoutation marks and combine values in a vector
I wish to place quotation marks around each element of the following list; X1 1 Label 1 2 Label 2 3 Label 3 4 Label 4 and combine the values in the following format for use in another function; c("Label 1","Label 2","Label 3","Label 4") Many thanks, Jerry
Gabor Grothendieck
2006-Apr-25 12:05 UTC
[R] Add qoutation marks and combine values in a vector
Use dQuote. Assuming you have a data frame with the column as factors: DF <- data.frame(x = letters) # test data levels(DF$x) <- dQuote(levels(DF$x)) On 4/25/06, Jerry Pressnell <jpressnell at westnet.com.au> wrote:> I wish to place quotation marks around each element of the following > list; > > X1 > 1 Label 1 > 2 Label 2 > 3 Label 3 > 4 Label 4 > > and combine the values in the following format for use in another > function; > > c("Label 1","Label 2","Label 3","Label 4") > > Many thanks, > > Jerry > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >