Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Double quotes not escaped in R

Tags:

r

I need the to escape the double quotes in the following example and R returns :

xx<-"the road is 'rocky all \"the\" way'"
xx

[1] "the road is 'rocky all \"the\" way'"

The final string should contain both the single and the double quotes

the road is 'rocky all "the" way' 

How can I achieve this?

like image 667
agatha Avatar asked Feb 19 '13 14:02

agatha


1 Answers

You already achieved it. It's just that print() escapes the quotes when displaying them :

R> xx <- "the road is 'rocky all \"the\" way'"
R> cat(xx)
the road is 'rocky all "the" way'
like image 190
juba Avatar answered Oct 12 '22 07:10

juba