How do I return a character string with quotes inside string? For example, what logic do I use if I want to return the following: Test Score="A" I tried the following .... Score<-paste("Test Score=","A",sep='"') But it returned a "\" inside: "Test Score=\"A" Any assistance would be greatly appreciated. [[alternative HTML version deleted]]
On 20/12/2011 2:10 PM, Mike Pfeiff wrote:> How do I return a character string with quotes inside string? > > For example, what logic do I use if I want to return the following: > > Test Score="A" > > I tried the following .... > > Score<-paste("Test Score=","A",sep='"') > > But it returned a "\" inside:No it didn't, as Uwe explained to you. Duncan Murdoch> > "Test Score=\"A" > > > > Any assistance would be greatly appreciated. > [[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.
On 20.12.2011 20:10, Mike Pfeiff wrote:> How do I return a character string with quotes inside string? > > For example, what logic do I use if I want to return the following: > > Test Score="A" > > I tried the following .... > > Score<-paste("Test Score=","A",sep='"') > > But it returned a "\" inside: > > > "Test Score=\"A" > > > > Any assistance would be greatly appreciated.That is the print()ed R representation of it. The underlying value *within* the quoted string is actually: Test Score="A and that is always true. E.g. in your example with the SQL query this question probably is derived from. cat() shows the actual version (but does not return) it. Uwe Ligges> > [[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.
Seemingly Similar Threads
- read .csv from web from password protected site
- Getting 2 kinds of quotes inside a pasted string
- RODBC Error: 'getCharCE' must be called on a CHARSXP
- problem with get() inside of lme()
- Timing benefits of mapply() vs. for loop was: Wrap a loop inside a function