Skip to content

Instantly share code, notes, and snippets.

@geotheory
Last active September 30, 2020 10:44
Show Gist options
  • Save geotheory/f9d638d3e4a7e329fb1754582e2f883e to your computer and use it in GitHub Desktop.
Save geotheory/f9d638d3e4a7e329fb1754582e2f883e to your computer and use it in GitHub Desktop.
fn = function(){ print("hello"); message("bye bye") }
sink(tt <- textConnection("results","w"),split=TRUE)
msg_results <- utils::capture.output(eval(parse(text = 'fn()')), type='message')
sink()
results
close(tt)
cat(paste(results, msg_results, collapse='\n'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment