run_and_format | R Documentation |
This builds on the reprex::reprex()
function to take a chunk of code,
run it and copy the formatted code and output to the clipboard. Note that
this does NOT run in a clean session and is thus unlikely to create reproducible
examples. Instead, it is intended to be used to quickly get a formatted bit
of code and output that is not self-contained, e.g., for teaching materials.
run_and_format(code = NULL)
code |
The code to run - can be NULL, then the code is retrieved from the clipboard. |
if (interactive()) {
name <- "Lukas"
run_and_format(paste("My name is", name))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.