I need to execute an external tool from R
and process errors (if any) occurred in that tool.
I know 3 functions to do something familiar with my task:
shell, system and system2.
Trying to test those, I see that command
shell("notepad")
opens notepad. As far as I know shell doesn't allow to check errors (there's no interface to look into stderr
).
When I call
system("notepad")
or
system2("notepad")
R
freezes trying to make those commands.
Calling
system("start notepad")
or
system2("start notepad")
returns warning
Warning message:
running command '"start notepad"' had status 127
notepad
not being in the PATH and therefore is not visible to R for executing it. On my machine, I can callsystem("java -version")
with no trouble. Strangely, I could not get Notepad to launch from R even after adding it to my PATH. – Diastylesystem("git version")
to work. There may be an issue with non command line programs in R. Why do you want to launch Notepad from R may I ask? – Diastylegit
is not on yourPATH
. Typeecho %PATH%
from a command prompt and you will see this. – Diastylesystem()
cannot launch a new window. So it hangs for Notepad. – Diastyle