hgd_watch | R Documentation |
This function may be used to rapidly develop visualizations by replacing a workflow of reloading and executing code manually.
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,
...
)
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 |
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.