[R] Quotation marks in Strings?

Douglas Bates bates at stat.wisc.edu
Fri Dec 27 00:03:03 CET 2002


tuffek at jippii.fi writes:

> How do I construct following string:
> s <- " *** "Hello!" *** "

Either

> s <- ' *** "Hello!" *** '
> s
[1] " *** \"Hello!\" *** "
> cat(s)
 *** "Hello!" *** > 

or

> s <- " *** \"Hello!\" *** "
> cat(s)
 *** "Hello!" *** > 

Note that when you print a string all " characters are expressed as \"
but if you use the cat function you get the actual string as it is
stored.




More information about the R-help mailing list