load_vars: Load environment variables into the current R session

Description Usage Arguments Value Examples

Description

load_vars reads the contents of an environment file, loads, evaluates and sets environment variables in the current R session.

Usage

1
load_vars(env_file)

Arguments

env_file

A connection object or character string to pass to readLines.

Value

Invisibly, a list object containing all currently set environment variables.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
# read variables from file
load_vars("~/.bashrc")

# acccess via standard call to Sys.getenv
Sys.getenv("foo") # "bar"

# alternatively, access via the return value
vars <- load_vars(".env")
vars$foo # "bar"


## End(Not run)

drewlanenga/renv documentation built on May 11, 2019, 4:17 p.m.