Captures the output from .Last.value along with the last expression from the history file and formats them in a manner suitable for posting on Stack Overflow.

solast(silent = FALSE, clip = TRUE, drop.curly.brace = TRUE, ...)

Arguments

silent

logical(1L) set to TRUE to suppress screen display

clip

logical(1L) set to TRUE (default) to attempt to write to system clipboard

drop.curly.brace

if the last call is a call to {, drop it and show only the contents (see examples)

...

arguments to pass on to lastcall

Value

character, invisibly, the call and value together formatted for posting on SO

Details

If you the expression you want captured spans multiple lines, enclose them in a call to {. The curly braces will be dropped from the display to make it appear as if you typed all the commands sequentially into the R prompt, though any interim output will not be captured.

Please note that the only output that is "captured" by this function is the result of evaluating .Last.value. If there were warning, errors, or other screen output during the actual expression evaluation those will not show up here.

See also

lastcall for limitations in capturing the last call

Author

Andanda Mahto, Brodie Gaslam

Examples

if (FALSE) { 1 + 1 solast() { x <- runif(20) x + 3 } solast() }