View source: R/sourcoise_refresh.R
sourcoise_refresh | R Documentation |
All scripts (passed to sourcoise_refresh()
) are executed with logging enabled.
sourcoise_refresh(
what = NULL,
force_exec = TRUE,
unfreeze = TRUE,
quiet = FALSE,
init_fn = getOption("sourcoise.init_fn"),
root = NULL,
log = "INFO",
.progress = TRUE
)
what |
(tibble) a tibble as generated by |
force_exec |
(boolean) (default |
unfreeze |
(boolean) (default |
quiet |
(boolean) (default |
init_fn |
(function) (default |
root |
(default |
log |
(character) (default |
.progress |
(boolean) (default |
The function returns the list of script executed but its main effect is a side-effect as scripts are executed and caches updates accordingly. Note also that log files reflect execution and track possible errors. Because of logging the execution comes with a loss in performance, which is not an issue if scripts are long to execute.
It is possible to execute sourcoise_refresh()
without execution forcing (force_exec=FALSE
) or with it.
Forced execution means that the script is executed even if the cache is valid.
In the case of non forced execution, execution is triggered by other cache invalidation tests (change in source file, lapse or tacked files).
When scripts are linked to qmds (i.e. when run in a quarto project), it is possible to unfreeeze and uncache those qmds with the option unfreeze=TRUE
.
This allows to refresh the cahe and then render the qmds using the new data.
It is possible to pass to refresh a function that will be executed before every script. This allows to load packages and declare global variables that can be used in each script. If packages are loaded inside the script, then this is not needed.
Parameters registered ins sourcoise_status()
such as wd
or args
are used to execute the script.
a list of r scripts (characters) executed, with timing and success and a side effect on caches
Other sourcoise:
sourcoise()
,
sourcoise_clear()
,
sourcoise_reset()
,
sourcoise_status()
dir <- tempdir()
fs::file_copy(
fs::path_package("sourcoise", "ipch", "prix_insee.R"),
dir,
overwrite = TRUE)
# Force execution (root is set explicitly here, it is normally deduced from project)
data <- sourcoise("prix_insee.R", root = dir, force_exec = TRUE)
# we then refresh all caches
sourcoise_refresh(root = dir)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.