Load Both User-Global and Project-Specific R Profile Configurations

Use rprofile::load() inside a project '.Rprofile' file to ensure that the user-global '.Rprofile' is loaded correctly regardless of its location, and other common resources (in particular 'renv') are also set up correctly.


rprofile

rprofile stream-lines project .Rprofile configuration loading.

Installation

rprofile is on CRAN. Install it via

install.packages('rprofile')

Usage

To use the package, add the following as the first line in a project .Rprofile file:

if (requireNamespace("rprofile", quietly = TRUE)) rprofile::load()

In most cases, that’s it. See the documentation for available parameters to customize the configuration.

At the moment, rprofile performs the following actions, in order, unless disabled via arguments:

  1. If the project is using an renv environment, it will be activated.
  2. If the project contains a .env file in its current path, the environment variables it contains will be loaded via readRenviron().
  3. The user profile (that is, the file ~/.Rprofile, or a file set via the R_PROFILE_USER environment variable) is loaded. Any errors that occur while loading this file will be converted into warnings, and rprofile::load() will invisibly return whether the file loaded without errors.
  4. If the project is an R package, load it via pkgload::load_all(export_all = FALSE). To avoid disrupting the regular package load order, this action will be deferred until after all default packages (given by getOption('defaultPackages')) have been loaded and attached.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("rprofile")

0.4.0 by Konrad Rudolph, 3 years ago


Report a bug at https://github.com/klmr/rprofile/issues


Browse source code at https://github.com/cran/rprofile


Authors: Konrad Rudolph [cre, aut] , F. Hoffmann-La Roche AG [cph, fnd]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports utils

Enhances pkgload, renv


See at CRAN