2013-01-07 41 views
1

我想R中有"(双引号)粘贴的命令内在R添加““”报价粘贴命令里面

paste("perl -ane 'system("cat /auto/Sample_output/tmp.$F[0].vcf >> Sample_90061.vcf");'",sep="") 

它说

Error: unexpected symbol in "paste("perl -ane 'system("cat" 

我试着单独创建的报价部分,然后通过

complicated = paste('"cat /auto/Sample_output/tmp.$F[0].vcf >> Sample_90061.vcf"',sep="") 

贴吧,但它显示为

> complicated 
[1] "\"cat /auto/Sample_output/tmp.$F[0].vcf >> Sample_90061.vcf\"" 

有人可以帮我解决这个问题吗?

+1

把“in”。你使用\“例如:”男孩说,“Hello World!”“ – u8sand

+0

'shQuote','sQuote'和'dQuote'可能也是需要查看的功能。 – Dason

回答

3

Escape "带反斜杠\。所以你将有:

paste("perl -ane 'system(\"cat /auto/Sample_output/tmp.$F[0].vcf >> Sample_90061.vcf\");'",sep="") 
+1

是的。有时可能包括'''如果字符串用单引号括起来,但是这里没有尝试,因为这个答案是“更正确的”。 –