The r
front-end was written with four distinct usage modes in mind.
First, it allow to write so-called ‘shebang’ scripts starting with
#!/usr/bin/env r
. These ‘shebang’ scripts are
perfectly suited for automation and execution via e.g. via cron
.
Second, we can use r somefile.R
to quickly execute the name R source file.
This is useful as r
is both easy to type---and quicker to start that either
R
itself, or its scripting tool Rscript
, while still loading the
methods
package.
Third, r
can be used in ‘pipes’ which are very common in Unix. A
simple and trivial example is echo 'cat(2+2)' | r
illustrating that the
standard output of one program can be used as the standard input of another
program.
Fourth, r
can be used as a calculator by supplying expressions after the
-e
or --eval
options.