Create WebR REPL sharelinks from a directory of R files
webr_repl_directory.Rd
Batch processes all R files in a directory to create individual WebR sharelinks. Useful for converting collections of scripts, examples, or course materials.
Usage
webr_repl_directory(
directory_path,
autorun = FALSE,
pattern = "\\.R$",
base_path = "/home/web_user/",
mode = NULL,
version = "latest",
base_url = NULL
)
Arguments
- directory_path
Character string specifying the path to the directory containing R files
- autorun
Logical. Whether to enable autorun for all generated links (default: FALSE)
- pattern
Regular expression pattern to match files (default: "\\.R$" for R files)
- base_path
Base directory path for files in WebR (default: "/home/web_user/")
- mode
Character vector or string specifying which WebR interface components to show. Valid components: "plot", "files", "terminal", "editor". Can be c("plot", "files") or "plot-files". If NULL (default), shows all components.
- version
WebR version to use ("latest" or specific version >= "v0.5.4")
- base_url
WebR application URL. If NULL, uses global option or builds from version
Examples
if (FALSE) { # \dontrun{
# Process all R files in a directory
links <- webr_repl_directory("./examples/", autorun = TRUE)
# Show only editor and terminal for all files
links <- webr_repl_directory("./examples/",
mode = c("editor", "terminal"))
# Process with custom settings and interface mode
links <- webr_repl_directory("./course/",
pattern = "exercise.*\\.R$",
base_path = "/exercises/",
mode = "editor-plot",
version = "v0.5.4")
# Save links to a file
writeLines(paste(names(links), links, sep = ": "), "webr_links.txt")
} # }