create_safe_environment: Create a safe environment

Description Usage Arguments Value Examples

Description

Creates an environment where the safe expressions are to be evaluated.

Usage

1

Arguments

dplyr

Load a collections of dplyr functions in the environment.

plot

Load a collection of graphics and ggplot2 functions in the environment.

Value

An environment that uses the empty environment (emptyenv()) as its parent. The environment serves as a "whitelist" to prevent users of evaluator$eval() to invoke malicious operations.

Examples

1
2
3
4
5
6
7
8
safe_env <- create_safe_environment()
eval(parse(text = "2 + 2"), safe_env)

## Not run: 
## trigger an error
eval(parse(text = "system('mkdir(test)')"), safe_env)

## End(Not run)

GregorDeCillia/kasper documentation built on May 5, 2019, 11:06 p.m.