双引号未在R中转义

时间:2013-02-19 14:41:01

标签: r

我需要在以下示例中转义双引号并且R返回:

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

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

最终字符串应包含单引号和双引号

the road is 'rocky all "the" way' 

我怎样才能做到这一点?

1 个答案:

答案 0 :(得分:20)

你已经实现了它。只是print()在显示时忽略了引号:

R> xx <- "the road is 'rocky all \"the\" way'"
R> cat(xx)
the road is 'rocky all "the" way'
相关问题