问题
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