get_sys_env: Read an environment variable and if needed, assign a default...

View source: R/utils.R

get_sys_envR Documentation

Read an environment variable and if needed, assign a default value.

Description

Read an environment variable and if needed, assign a default value.

Usage

get_sys_env(
  var,
  default = NULL,
  type = c("character", "double", "integer", "logical"),
  verbose = getOption("scdrake_verbose")
)

Arguments

var

A character scalar: name of environment variable.

default

A default value (different from NULL) when environment variable is unset (empty string).

type

A character scalar: to which R type will be the variable coerced.

verbose

A logical scalar: if TRUE, be verbose. The default value is obtained from getOption("scdrake_verbose").

Value

A character scalar if the environment variable is set, default if not, or empty character scalar when default = NULL and the variable is unset.

Examples

get_sys_env("PATH")
get_sys_env("NON_EXISTING")
get_sys_env("NON_EXISTING", default = "default_value")

bioinfocz/scdrake documentation built on Sept. 19, 2024, 4:43 p.m.