'RStudio' provides interfaces jobRunScript
to
schedule background jobs. However, this
functionality only applies using 'RStudio' IDE. When launching R from
other places such as terminals, the job scheduler usually result in
errors. In this case, the alternative is to call system command via
Rscript
The expression expr
will run a clean environment. Therefore R objects
created outside of the context will be inaccessible from within the child
environment, and packages except for base packages will not be loaded.
There is a small difference when running within and without 'RStudio'.
When running via Rscript
, the environment will run under
vanilla
argument, which means no load, no start-up code. If you
have start-up code stored at ~/.Rprofile
, the start-up code will be
ignored. When running within 'RStudio', the start-up code will be executed.
As of rstudioapi
version 0.11, there is no 'vanilla' option. This
feature is subject to change in the future.