run: Evaluate character strings as an expression

View source: R/run.R

runR Documentation

Evaluate character strings as an expression

Description

Evaluate character strings as an expression in the appropriate frame so the function can be used in a function and use variables in the environment of the function.

Usage

run(
  ...,
  envir = parent.frame(),
  enclos = if (is.list(envir) || is.pairlist(envir)) parent.frame() else baseenv(),
  try = TRUE
)

Arguments

...

expressions that can evaluate to character strings to paste.

envir

(default = parent.frame()) see eval.

enclos

(default same as eval)

try

(default: TRUE) enclose the expression in try.

Value

the result of evaluating paste0(...) as an expression

Examples

run('ls()')
for(nam in c('ls','search')) print(run(nam,"()"))  # very unimaginative example

gmonette/spida2 documentation built on Aug. 20, 2023, 7:21 p.m.