Examples for 'evaluate::evaluate'


Evaluate input and return all details of evaluation

Aliases: evaluate

Keywords:

### ** Examples

evaluate(c(
  "1 + 1",
  "2 + 2"
))
<evaluation>
Source code: 
  1 + 1
Text output: 
  [1] 2
Source code: 
  2 + 2
Text output: 
  [1] 4
# Not that's there's a difference in output between putting multiple
# expressions on one line vs spreading them across multiple lines
evaluate("1;2;3")
<evaluation>
Source code: 
  1;2;3
Text output: 
  [1] 1
Text output: 
  [1] 2
Text output: 
  [1] 3
evaluate(c("1", "2", "3"))
<evaluation>
Source code: 
  1
Text output: 
  [1] 1
Source code: 
  2
Text output: 
  [1] 2
Source code: 
  3
Text output: 
  [1] 3
# This also affects how errors propagate, matching the behaviour
# of the R console
evaluate("1;stop(2);3")
<evaluation>
Source code: 
  1;stop(2);3
Text output: 
  [1] 1
Condition: 
  Error:
  2
evaluate(c("1", "stop(2)", "3"))
<evaluation>
Source code: 
  1
Text output: 
  [1] 1
Source code: 
  stop(2)
Condition: 
  Error:
  2
Source code: 
  3
Text output: 
  [1] 3

[Package evaluate version 1.0.1 Index]