我试图产生这个输出字符串
CONTAINS(ORIG_DOC,'SECTIONS("7 - Past Medical/Surgical History")(PRECISE FORM OF "DM", PRECISE FORM OF "DM2", "diabetes")') <> 0
使用下面的粘贴功能
paste("CONTAINS(ORIG_DOC,'SECTIONS("7 - Past Medical/Surgical History")(PRECISE FORM OF "DM", PRECISE FORM OF "DM2", "diabetes")') <> 0")
我收到错误
Error: unexpected numeric constant in "paste("CONTAINS(ORIG_DOC,'SECTIONS("7"
不确定我在这里缺少什么,非常感谢任何帮助。
答案 0 :(得分:0)
将所有双引号"
转义为\"
并使用noquote
:
> txt = noquote(paste("CONTAINS(ORIG_DOC,'SECTIONS(\"7 - Past Medical/Surgical History\") (PRECISE FORM OF \"DM\", PRECISE FORM OF \"DM2\", \"diabetes\")') <> 0"))
> txt
[1] CONTAINS(ORIG_DOC,'SECTIONS("7 - Past Medical/Surgical History") (PRECISE FORM OF "DM", PRECISE FORM OF "DM2", "diabetes")') <> 0
>