Learn R Programming

covr (version 1.2.0)

with_something: Execute code in temporarily altered environment.

Description

  • in_dir: working directory
  • with_collate: collation order
  • with_envvar: environmental variables
  • with_libpaths: library paths, replacing current libpaths
  • with_lib: library paths, prepending to current libpaths
  • with_locale: any locale setting
  • with_options: options
  • with_path: PATH environment variable
  • with_par: graphics parameters

Usage

with_envvar(new, code, action = "replace")

with_locale(new, code)

with_collate(new, code)

in_dir(new, code)

with_libpaths(new, code)

with_lib(new, code)

with_options(new, code)

with_par(new, code)

with_path(new, code, add = TRUE)

with_makevars(new, code, path = file.path("~", ".R", "Makevars"))

Arguments

new
values for setting
code
code to execute in that environment
action
(for with_envvar only): should new values "replace", "suffix", "prefix" existing environmental variables with the same name.
add
Combine with existing values? Currently for with_path only. If FALSE all existing paths are overwritten, which don't you usually want.
path
location of existing makevars to modify.

Details

if NA is used as a value with with_envvar those environment variables will be unset. If there are any duplicated variable names only the last one is used.

If no existing makevars file exists or the fields in new do not exist in the existing Makevars file then the fields are added to the new file. Existing fields which are not included in new are appended unchanged. Fields which exist in Makevars and in new are modified to use the value in new.