captureAll {svMisc}R Documentation

Run an R expression and capture output and messages in a similar way as it would be done at the command line

Description

This function captures results of evaluating an R expression the same way as it would be done in a R console. The result is in a character string. Errors, warnings and other consitions are treated as usual, including the delayed display of the warnings if options(warn = 0).

Usage

captureAll(expr)

Arguments

expr A valid R expression to evaluate

Value

Returns a string with the result of the evaluation done in the user workspace.

Author(s)

Philippe Grosjean (phgrosjean@sciviews.org)

See Also

Parse, clipsource

Examples

writeLines(captureAll(1+1))
writeLines(captureAll(Parse("search()")))
  
## Not run: 
writeLines(captureAll(Parse('1:2 + 1:3')))
writeLines(captureAll(Parse("badname")))
## End(Not run)

[Package svMisc version 0.9-46 Index]