Skip to contents

Creates a WebR sharelink for projects with multiple R files, data files, or other resources. Useful for sharing complete analyses, packages, or educational materials.

Usage

webr_repl_project(
  files,
  autorun_files = character(0),
  base_path = "/home/web_user/",
  mode = NULL,
  version = "latest",
  base_url = NULL
)

Arguments

files

Named list where names are filenames and values are file content as character strings

autorun_files

Character vector of filenames to auto-execute when project loads, or "all" to autorun all R files (default: none)

base_path

Base directory path for all files (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

Value

webr_project object containing the WebR sharelink for the multi-file project

Examples

# Create a project with multiple files
files <- list(
  "main.R" = "source('utils.R')\nresult <- analyze_data(mtcars)",
  "utils.R" = "analyze_data <- function(data) { summary(data) }",
  "README.md" = "# My Analysis\nThis project analyzes the mtcars dataset."
)

# Autorun specific files
link <- webr_repl_project(files, autorun_files = "main.R")

# Autorun all R files
link <- webr_repl_project(files, autorun_files = "all")

# Autorun multiple specific files
link <- webr_repl_project(files, autorun_files = c("main.R", "utils.R"))

# No autorun (default)
link <- webr_repl_project(files)

# Show only files and editor for project management
link <- webr_repl_project(files, mode = c("files", "editor"))

# Custom base path, version, and interface mode
link <- webr_repl_project(files,
                         base_path = "/workspace/",
                         mode = "files-editor-terminal",
                         version = "v0.5.4")