On Thu, 11 Sep 2003, Philippe Hup� wrote:

> I would like to write in a variable the following string :
> 
> Hello "World"
> 
> If I do cat("Hello ","\"World\""), I have the good result on the screen 
> but it can not be affected to a variable. If I do the same thing with 
> paste paste("Hello ","\"World\"") it does not work since \" seems to be 
> not recognized. So what is the trick to do that.

It is recognized:

> xx <- paste("Hello ","\"World\"") 
> print(xx)
[1] "Hello  \"World\""
> cat(xx, "\n")
Hello  "World" 
> print(xx, quote=FALSE)
[1] Hello  "World"

It's likely that it is the behaviour of print() you did not understand: 
the quote appears by itself in the character string but is escaped when 
printed within quotes.

-- 
Brian D. Ripley,                  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to