shellruns the command specified by
cmd, usually under a shell, because that is what the POSIX standards require.
shell(cmd, shell, flag = "/c", intern = FALSE, wait = TRUE, translate = FALSE, mustWork = FALSE, ...)
NULL(no shell). If missing, a suitable shell is chosen: see ‘Details’.
shthe default is changed to
intern = TRUE.
TRUE, "/" in
cmdis translated to "\".
TRUEfailure to run the command will give an R error, if
FALSEa warning and if
NA, no R message.
intern = TRUE, a character vector giving the output of the command, one line per character string, or an error message if the command could not be run. If
intern = FALSE, the return value is an error code, given the invisible attribute (so needs to be printed explicitly). If the command could not be run for any reason, the value is
-1and an R warning is generated. Otherwise if
wait = FALSEthe value is the error code returned by the command, and if
wait = TRUEit is the zero (the conventional success value), If
intern = FALSEand
wait = TRUE(the defaults) the text output from a command that is a console application will appear in the R console (
Rgui) or the window running R (
shellis specified, the environment variables
COMSPECare tried in turn:
COMSPECshould always succeed. Using
shell = NULLinvokes the command
cmddirectly, in which case an extension of
.exeis assumed. It is possible to use batch files directly if their extension is given: Windows (rather than R) then chooses a shell. See
systemfor fuller details:
shellis a more user-friendly wrapper for
system. To make use of Windows file associations, use