| assign.redo | R Documentation |
When you have various chunks of code you may or may not to rerun during script execution (and rather load from a file, say), you can set certain variables to TRUE/FALSE for use in if() statements to run that chunk or not. This function creates those variables and assigns them their default state.
assign.redo(redo.vars, state = FALSE)
redo.vars |
A character vector of the variable names you want to give TRUE or FALSE to |
state |
A the default state to set the redo variables to, either TRUE or FALSE |
chunk.names <- c("chunk1", "chunk2")
assign.redo(chunk.names)
if (redo$chunk1) {
x <- rnorm(100)
} else {
x <- data(example_data1)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.