View source: R/sourceIfChanged.R
sourceIfChanged | R Documentation |
Rather than sourcing your analysis script many times, which can be cumbersome, this script skips the
sourcing if there is a .log
file that matches the sourced file. If that matching .log
file exists, the corresponding .RData
file is loaded. Otherwise, the file is sourced and both
.log
and .RData
files are created.
sourceIfChanged(filepath)
filepath |
.R file to source The intended use is largely for when the user wants reproducible results (sometimes requiring long analyses) while writing .Rmarkdown documents. While working with the main text, formatting, and such, it's nice to just load pre-run data rather than waiting to source every time. There are important implications, such as the fact that only the sourced file is checked for changes, and therefore the old data will be loaded even if other things (e.g., global variables) have been changed. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.