[R] how to insert a double quote with the paste function?

Philippe Glaziou glaziou at pasteur-kh.org
Thu Sep 11 10:10:21 CEST 2003


Philippe Hupé <Philippe.Hupe at curie.fr> 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.


How about:

> h<-'hello "World"'
> h
[1] "hello \"World\""
> cat(h, "\n")
hello "World"
> 

-- 
Philippe Glaziou
Institut Pasteur du Cambodge




More information about the R-help mailing list