6.9 Respect the R landscape
As people will use your package in many situations you should avoid editing the global settings, so we should avoid applying any of the functions in R/:
- Loading a package with
library()orrequire(). - Loading code with
source(). - Changing a global option with
options(). - Modifying the working directory with
setwd(). - Specifying seeds for creating random numbers with
set.seed(). - Setting graphical parameters with
par(). - Setting environment variable with
Sys.setenv(). - Setting aspects of the locale with
Sys.setlocale().
If you must use them, make sure to clean up after yourself.