system2 functioning in R

柔情痞子 提交于 2019-12-12 02:01:14

问题


When I run a batch file through system2 in R:

The following runs the batch file without any issue:

system2("Run.bat")

However, this one gives an error:

system2("Run", stdout=stdout, stderr=stderr)
Warning message:
running command '"Run.bat"' had status 1 

Any insights on what might be causing this?


回答1:


Read the documentation carefully:

stdout, stderr where output to ‘stdout’ or ‘stderr’ should be sent. Possible values are "", to the R console (the default), NULL or FALSE (discard output), TRUE (capture the output in a character vector) or a character string naming a file.

Seems like you need to specify those arguments as character strings.



来源:https://stackoverflow.com/questions/26554628/system2-functioning-in-r

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