comma within paste in R

人盡茶涼 提交于 2019-12-08 06:49:36

问题


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 ?


回答1:


One option would be

(x <- paste("var", i, 'option="juk"', "--opt2 12"))
# [1] "var 4 option=\"juk\" --opt2 12"
cat(x)
# var 4 option="juk" --opt2 12


来源:https://stackoverflow.com/questions/35779204/comma-within-paste-in-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!