Tom*_*ers 6 executable r external call
我试图通过调用从R内部调用一个名为AMDIS的Windows程序
system("C:/NIST08/AMDIS32/AMDIS_32.exe /S C:/Users/Ento/Documents/GCMS/test_cataglyphis_iberica/queens/CI23_Q_120828_01.CDF")
Run Code Online (Sandbox Code Playgroud)
为了/S在一个被调用的文件上进行分析(使用开关指定)CI23_Q_120828_01.CDF,但似乎无论我尝试什么文件都没有正确加载,大概是因为选项没有被传递.有没有人知道我可能做错了什么?
现在这个命令也是
给了我错误
警告信息:
运行命令'C:/NIST08/AMDIS32/AMDIS_32.exe/S C:/Users/Ento/Documents/GCMS/test_cataglyphis_iberica/queens/CI23_Q_120828_01.CDF'的状态为65535
(我不知道是什么导致同一命令的这些不同结果)
(在AMDIS命令行选项中描述这里在8页)
干杯,
汤姆
编辑:
发现它与前锋vs反斜杠有关 - 运行
system("C:\\NIST08\\AMDIS32\\AMDIS_32.EXE C:\\Users\\Ento\\Documents\\GCMS\\test_cataglyphis_iberica\\queens\\CI23_Q_120828_01.CDF /S /E")
Run Code Online (Sandbox Code Playgroud)
似乎工作 - 谢谢大家的建议!
你听说过的bquote,noquote,sQuote,dQuote,quote enquote和Quotes,现在好了满足shQuote!:-)
这个小函数调用用于格式化要传递给操作系统shell的字符串.就个人而言,我发现我可以卷入逃避地狱的反斜杠,并shQuote拯救我.只是,你会选择你的命令行中输入字符串('sh'适用于Unix相似者一样bash,csh对于C-外壳和'cmd'用于Windows外壳程序)wihtin shQuote,它会格式化它从一个电话R使用的系统:
shQuote("C:/NIST08/AMDIS32/AMDIS_32.exe /S C:/Users/Ento/Documents/GCMS/test_cataglyphis_iberica/queens/CI23_Q_120828_01.CDF" , type = "cmd" )
#[1] "\"C:/NIST08/AMDIS32/AMDIS_32.exe /S C:/Users/Ento/Documents/GCMS/test_cataglyphis_iberica/queens/CI23_Q_120828_01.CDF\""
Run Code Online (Sandbox Code Playgroud)
更一般地说,您可以shQuote像这样使用:
system( shQuote( "mystring" , type = c("cmd","sh") ) , ... )
Run Code Online (Sandbox Code Playgroud)