Philippe

You seem to have the right answer already, unless I misunderstand...

If I define:

> x = "Hello \"World\""
Then the default print method for this character string will give the rather ugly 
looking:

> x
[1] "Hello \"World\""

But this is just R telling us that it does recognise the escape sequence \". If we 
pass this variable to a more output-friendly function like cat, we get:

> cat(x)
Hello "World"

So the variable x really does contain  'Hello "World"', it's just that R's default 
print method will show the escape characters used in a string. 




-----Original Message-----
From: Philippe Hup� [mailto:[EMAIL PROTECTED] 
Sent: 11 September 2003 08:55
To: '[EMAIL PROTECTED]'
Subject: [R] how to insert a double quote with the paste function?


Hello,

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.

Thanks,

Philippe
-- 

--------------------------------------------------

Philippe Hup�
Institut Curie - Equipe Bioinformatique
26, rue d'Ulm - 75005 PARIS France
+33 (0)1 44 32 42 75

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>

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

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

Reply via email to