catAndRun | R Documentation |
Print Debug Messages Before and After Running Code
catAndRun(
messageText = "Running code",
expr,
newLine = 2L,
dbg = TRUE,
log_time = TRUE
)
messageText |
text to be printed before running the code |
expr |
expressions to be run. Enclose more than one expression in curly braces |
newLine |
integer controlling new lines. 0: no extra new line, 1:
new line after |
dbg |
logical. If |
log_time |
logical. If |
This function returns the evaluation of expr
. The result is
returned invisibly so that the result of an assignment as the last
expression in exprt
does not show up on the console.
for (newLine in 0:3) {
catAndRun("work hard", newLine = newLine, {
cat("hard\nworking\n")
})
cat("here.\n\n")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.