Skip to contents

Launches the standalone Chart Builder (an HTML/CSS/JS Plotly app) in the default browser with data already loaded, dropping the user straight onto the data-setup screen. This is a one-way, interactive launcher: data flows from R into the browser, and the finished chart is exported from within the app. There is no automated round-trip back to R.

Usage

ChartBuilder(
  data,
  app_dir = getOption("nourkit.chart_builder_dir", system.file("Chart_Builder", package =
    "scSidekick")),
  filename = NULL,
  max_rows = NULL,
  launch = TRUE
)

Arguments

data

A data.frame (or object coercible with as.data.frame()), or a Seurat object - in which case its meta.data slot is used.

app_dir

Character. Path to the Chart Builder app directory (the folder containing chart_builder.html). Defaults to the bundled copy inside the scSidekick package (inst/Chart_Builder), or getOption("nourkit.chart_builder_dir") if set.

filename

Character. Name shown in the app for the loaded dataset. Defaults to the deparsed name of data with a .csv suffix.

max_rows

Integer or NULL. If set and data has more rows, a random sample of max_rows rows is sent (keeps the payload small). NULL (default) sends everything; the app itself samples large data for plotting. A warning is issued for very large frames.

launch

Logical. Open the browser? Default TRUE. FALSE builds the session directory and returns its path without opening (useful for tests).

Value

(Invisibly) the path to the temporary session directory containing the launched copy of the app.

Details

The app is copied into a fresh temporary directory on each call, so the source app is never modified and concurrent sessions do not collide. The app loads its charting libraries (Plotly, PapaParse, SheetJS) from CDNs, so an internet connection is required for it to render.