agatha
agatha

Reputation: 1513

Double quotes not escaped in 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?

Upvotes: 19

Views: 20905

Answers (1)

juba
juba

Reputation: 49033

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'

Upvotes: 32

Related Questions