R 中粘贴中的逗号 [英] comma within paste in R
本文介绍了R 中粘贴中的逗号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想粘贴带有"的内容.
I would like to paste something that has "" within.
> i = 4
> paste("var", i, "option="juk"", "--opt2 12")
Error: unexpected symbol in "paste("var", i, "option="juk"
粘贴的短语应该是什么样子(包括逗号)
What the pasted phrase should look like (which included comma within)
var 4 option = "juk" --opt2 12
有什么办法可以解决这个问题吗?
Is there any way to solve this ?
推荐答案
一种选择是
(x <- paste("var", i, 'option="juk"', "--opt2 12"))
# [1] "var 4 option=\"juk\" --opt2 12"
cat(x)
# var 4 option="juk" --opt2 12
这篇关于R 中粘贴中的逗号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文