hgd_watch {httpgd} | R Documentation |
Watch for changes in code files and refresh plots automatically.
Description
This function may be used to rapidly develop visualizations by replacing a workflow of reloading and executing code manually.
Usage
hgd_watch(
watch = list.files(pattern = "\\.R$", ignore.case = T),
on_change = function(changed_files) {
print(changed_files)
},
interval = 1,
on_start = hgd_browse,
on_exit = NULL,
on_error = print,
reset_par = TRUE,
...
)
Arguments
watch |
Paths that are watched for changes (see |
on_change |
Will be called when a file changes. |
interval |
Time interval in which changes are detected (in seconds). |
on_start |
Will be called after the httpgd server is started
(may be set to |
on_exit |
Will be called before the server is closed
(may be set to |
on_error |
Will be called when on_change throws an error
(may be set to |
reset_par |
If set to |
... |
Additional parameters passed to |
Examples
## Not run:
# --- my_code.R ---
plot(rnorm(100), col = "red")
# --- Other file / interactive ---
hgd_watch(
watch = "my_code.R", # When my_code.R changes...
on_change = function(...) {
source("my_code.R") # ...call updated plot function.
}
)
## End(Not run)
[Package httpgd version 2.0.2 Index]