[R] passing ", betrayed by the non-vanishing \

Thomas Lumley tlumley at u.washington.edu
Tue Apr 16 23:07:54 CEST 2002

On Tue, 16 Apr 2002, graham lawrence wrote:

> mtex[3]<-"I need\'s a \"double quote\" with no backslash"
> mtex[3]
> [1] "I need's a \"double quote\" with no backslash"
> so how is it done?  Thanks in advance,

Do you want to construct a string that contains a double quote and no
backslash or to print a double quote on the screen without printing a

You've done the first, as this shows
> a<-"\""
> a
[1] "\""
> nchar(a)
[1] 1
so a contains a single character, the double quote.

To display on the screen without a backslash use
> print(a,quote=F)
[1] "
> cat(a)


r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list