[Rd] R CMD BATCH vs R CMD batch

Deepayan Sarkar deepayan.sarkar at gmail.com
Thu Oct 29 09:51:57 CET 2015


On Thu, Oct 29, 2015 at 2:09 PM, Rainer M Krug <Rainer at krugs.de> wrote:
> Dirk Eddelbuettel <edd at debian.org> writes:
>
>> On 28 October 2015 at 21:39, Marius Hofert wrote:
>> | Out of laziness I just used "R CMD batch" instead of "R CMD BATCH". I
>> | didn't get an error so didn't think about the consequences... One
>> | consequence is (at least on Mac OS X 10.11 but probably in more
>> | generality) that R_BATCH_OPTIONS are ignored, which was kind of fatal
>> | in my case... I am thus wondering whether it makes sense to either a)
>> | have R_BATCH_OPTIONS also be respected for "R CMD batch" or b) simply
>> | not allow "R CMD batch" as a valid command (so requiring to use "R CMD
>> | BATCH"). Both approaches might be delicate... just wanted to point
>> | this issue out...
>>
>> Same reason we have 'R CMD INSTALL' as there often is /usr/bin/install with
>> different options ...
>>
>> In general 'R CMD foo' will run for any 'foo' in the path:
>>
>>    edd at max:~$ R CMD date
>>    Wed Oct 28 21:05:01 CDT 2015
>>    edd at max:~$
>
> So what is R CMD exactly doing in this example? The output is the same if
> I say only the command (using pwd as otherwise the time has changed...):
>
> ,----
> | 09:35:03 ~$ R CMD pwd
> | /Users/rainerkrug
> | 09:35:37 ~$ R CMD pwd
> | /Users/rainerkrug
> | 09:37:44 ~$ pwd
> | /Users/rainerkrug
> | 09:37:49 ~$
> `----
>
> And this happens, except in cases where the foo is defined as a CMD in R (build, ...):
>
> ,----
> | Commands:
> |   BATCH                       Run R in batch mode
> |   COMPILE             Compile files for use with R
> |   SHLIB                       Build shared library for dynamic loading
> |   INSTALL             Install add-on packages
> |   REMOVE              Remove add-on packages
> |   build                       Build add-on packages
> |   check                       Check add-on packages
> |   LINK                        Front-end for creating executable programs
> |   Rprof                       Post-process R profiling files
> |   Rdconv              Convert Rd format to various other formats
> |   Rd2pdf              Convert Rd format to PDF
> |   Rd2txt              Convert Rd format to pretty text
> |   Stangle             Extract S/R code from Sweave documentation
> |   Sweave              Process Sweave documentation
> |   Rdiff                       Diff R output ignoring headers etc
> |   config              Obtain configuration information about R
> |   javareconf          Update the Java configuration variables
> |   rtags                 Create Emacs-style tag files from C, R, and Rd files
> `----
>
> Unless I miss something, is this is an inconsistency in R?

One important difference (not sure if the only one) is that R CMD
defines more environment variables. Compare

env | grep -i tex
R CMD env | grep -i tex

So for example

R CMD pdflatex

will behave differently from plain pdflatex.

-Deepayan



More information about the R-devel mailing list