safe_eval: Safely eval a string as an expression

Description Usage Arguments Examples

View source: R/safe-eval.R

Description

Safely eval a string as an expression

Usage

1
2
3
4
5
6
7
8
safe_eval(
  x,
  vars = NULL,
  replace_comma = TRUE,
  insert_products = TRUE,
  allowed_functions = getGroupMembers("Math"),
  allowed_constants = c("pi")
)

Arguments

x

string to evaluate

vars

list with variable values

replace_comma

Replace ',' with '.' before parsing

insert_products

Make implicit products explicit

allowed_functions

functions (sequence of characters) that should not have products, e.g. cos, sin

Examples

1
safe_eval("2+2")

r-cas/iomath documentation built on May 28, 2021, 11:10 p.m.