Philip James Smith
2008-Jul-03 01:25 UTC
[R] How do I paste double quotes arround a character string?
Hi R Community: I've got a character string that looks like: New Mexico How to I create the new character string that looks like: "New Mexico" That is, it is the original string (New Mexico) with double quotes infront and behind it? Thanks, Phil Smith
Erik Iverson
2008-Jul-03 01:37 UTC
[R] How do I paste double quotes arround a character string?
Philip James Smith wrote:> Hi R Community: > > I've got a character string that looks like: New MexicoWhat does this mean? I do not think I understand. Do you have a vector with one element (New Mexico) in it? I think we need a few more details, like what it is exactly you have (class of your data), and what you want to do with it. If your string is in a variable 'x', try str(x) and class(x).> > How to I create the new character string that looks like: "New Mexico" > That is, it is the original string (New Mexico) with double quotes > infront and behind it? > > Thanks, > Phil Smith > > ______________________________________________ > 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.
(Ted Harding)
2008-Jul-03 08:22 UTC
[R] How do I paste double quotes arround a character string?
On 03-Jul-08 01:25:55, Philip James Smith wrote:> Hi R Community: > I've got a character string that looks like: New Mexico > > How to I create the new character string that looks like: "New Mexico" > That is, it is the original string (New Mexico) with double quotes > infront and behind it? > > Thanks, > Phil SmithI tried the following. Is that the sort of thing you want to achieve? X<-"New Mexico" Y<-"\"New Mexico\"" X # [1] "New Mexico" Y # [1] "\"New Mexico\"" plot((1:10),xlab=X,ylab=Y) Best wishes, Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk> Fax-to-email: +44 (0)870 094 0861 Date: 03-Jul-08 Time: 09:22:10 ------------------------------ XFMail ------------------------------