source_env: Source R code to an environment

View source: R/all.R

source_envR Documentation

Source R code to an environment

Description

Instead of sourcing R code in the global environment where it might create new objects or overwrite existing ones, create a new environment (or use an existing one) and source the code there!

Usage

source_env(RScript, env = new.env())

Arguments

RScript

path to the R file you want to run

env

the environment you want to run in. Defaults to a new environment.

Value

Returns the environment where the processing occurred.

Examples

# code_env <- source_env('file1.R')
# source_env('file2.R', code_env)


adamleerich/alrtools documentation built on March 12, 2024, 11:38 p.m.