assign_to_R_env {DIZtools}R Documentation

Add variable to R environment (in contrast to system environment).

Description

Hack variable into global env (bypasses R CMD checks). This does create a new variable in the R environment but NOT a new variable in the system environment. To create a system environment variable being accessible via 'Sys.getenv(...)', use the function 'DIZtools::setenv2(key = "varname", val = 7)'. Old function name: 'global_env_hack()'

Usage

assign_to_R_env(key, val, pos = 1)

Arguments

key

A character (!) string. The name of the assigned variable

val

An object. The object that will be assigned to 'key'.

pos

An integer. The position of the environment (default: 1).

Value

No return value, called for side effects (see description).

See Also

http://adv-r.had.co.nz/Environments.html

Examples

utils_path <- tempdir()
assign_to_R_env(
  key = "utils_path",
  val = utils_path,
  pos = 1L
)


[Package DIZtools version 1.0.1 Index]