| Title: | R Bindings to the 'Mosaic' Visualization Framework |
|---|---|
| Description: | Provides R bindings for 'Mosaic', a declarative grammar for linked, data-driven visualizations backed by 'DuckDB'. The package supplies 'htmlwidgets' and 'shiny' helpers for rendering 'Mosaic' specifications from R, including optional browser-side 'DuckDB-WASM' execution and selection export helpers for exploratory workflows. |
| Authors: | Timur Rizvanov [aut, cre], Edward C. Ruiz [aut], Ruben Dries [aut, rev], Dries Lab [fnd] (Host laboratory and funding source), Boston University [fnd] (Undergraduate Research Opportunities Program (UROP)) |
| Maintainer: | Timur Rizvanov <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.3 |
| Built: | 2026-06-25 19:59:22 UTC |
| Source: | https://github.com/cran/rMosaic |
After pressing "Import Selection" in a runMosaicWithExport
app, the selected data are stored inside the package under the name printed
in the status bar (e.g. "mosaic_sel_1"). Use this function to
retrieve a selection by that name.
get_mosaic_selection(name)get_mosaic_selection(name)
name |
Character scalar: the variable name returned by the import
button (e.g. |
The stored data.frame, or NULL with a warning if the
name is not found.
Returns the names of all selections currently held in the package store.
list_mosaic_selections()list_mosaic_selections()
Character vector of selection names.
Renders a Mosaic visualization using the provided specification and data.
mosaic( spec, specType = c("auto", "json", "yaml", "esm"), data = NULL, backend = c("r", "wasm"), data_transport = c("auto", "file", "inline"), data_dir = NULL, width = NULL, height = NULL )mosaic( spec, specType = c("auto", "json", "yaml", "esm"), data = NULL, backend = c("r", "wasm"), data_transport = c("auto", "file", "inline"), data_dir = NULL, width = NULL, height = NULL )
spec |
JSON/YAML (as R list, text, or file) or ESM JS code (text or file). |
specType |
One of "auto" (default), "json", "yaml", or "esm". |
data |
Named list of data.frames to register in DuckDB. |
backend |
Database backend: "r" (default) for R DuckDB or "wasm" for browser WASM DuckDB. |
data_transport |
How 'backend = "wasm"' input tables are delivered to the browser. '"auto"' uses '"file"' when 'data_dir' is supplied and otherwise falls back to '"inline"' for portable widgets; '"inline"' keeps the row-JSON path; '"file"' writes Arrow IPC files to 'data_dir' and registers them in DuckDB-WASM by URL. |
data_dir |
Directory for '"file"' transport. Serve or save the widget from the same directory so relative URLs resolve. |
width |
CSS or pixel width (e.g. "100%", "600px", or numeric). |
height |
CSS or pixel height. |
An htmlwidget that renders the Mosaic visualization.
Use this in the UI to create a placeholder for the Mosaic visualization.
mosaicOutput(outputId, width = "100%", height = "400px")mosaicOutput(outputId, width = "100%", height = "400px")
outputId |
output variable name |
width, height
|
CSS dimensions (e.g. '100%', '400px') for the container. |
A Shiny UI output element for a Mosaic htmlwidget.
Use this in the server to render the Mosaic visualization to the output.
renderMosaic(expr, env = parent.frame(), quoted = FALSE)renderMosaic(expr, env = parent.frame(), quoted = FALSE)
expr |
An expression that generates a call to |
env |
The environment in which to evaluate |
quoted |
Is |
A Shiny render function for use in a server output assignment.
Launches a Shiny application displaying the Mosaic visualization.
runMosaicApp( spec, specType = c("auto", "json", "yaml", "esm"), data, backend = c("r", "wasm"), title = NULL, width = "100%", height = "600px" )runMosaicApp( spec, specType = c("auto", "json", "yaml", "esm"), data, backend = c("r", "wasm"), title = NULL, width = "100%", height = "600px" )
spec |
JSON/YAML (as R list, text, or file) or ESM JS code (text or file). |
specType |
One of "auto" (default), "json", "yaml", or "esm". |
data |
Named list of data.frames to register in DuckDB. |
backend |
Database backend: "r" (default) for R DuckDB or "wasm" for browser WASM DuckDB. |
title |
Optional page title |
width |
CSS or pixel width (e.g. "100%", "600px", or numeric). |
height |
CSS or pixel height. |
A Shiny application object.
Runs a Mosaic app and allows exporting selections to R.
runMosaicExport( spec, specType = "auto", data, title = NULL, width = "100%", height = "600px", selection_env = NULL )runMosaicExport( spec, specType = "auto", data, title = NULL, width = "100%", height = "600px", selection_env = NULL )
spec |
JSON/YAML (as R list, text, or file) or ESM JS code (text or file). |
specType |
One of "auto" (default), "json", "yaml", or "esm". |
data |
Named list of data.frames to register in DuckDB. |
title |
Optional page title |
width |
CSS or pixel width (e.g. "100%", "600px", or numeric). |
height |
CSS or pixel height. |
selection_env |
where to store extracted selections |
A Shiny application object. When the user imports a selection, the
selected rows are assigned into selection_env as
mosaic_sel_<n>.
Launches a Shiny application that allows selecting data points and exporting them to an R environment.
runMosaicWithExport( spec, specType = c("auto", "json", "yaml", "esm"), data, title = NULL, width = "100%", height = "600px", selection_env = NULL )runMosaicWithExport( spec, specType = c("auto", "json", "yaml", "esm"), data, title = NULL, width = "100%", height = "600px", selection_env = NULL )
spec |
JSON/YAML (as R list, text, or file) or ESM JS code (text or file). |
specType |
One of "auto" (default), "json", "yaml", or "esm". |
data |
Named list of data.frames to register in DuckDB. |
title |
Optional page title |
width |
CSS or pixel width (e.g. "100%", "600px", or numeric). |
height |
CSS or pixel height. |
selection_env |
Environment to store selections in |
A Shiny application object. When the user imports a selection, the
selected rows are assigned into selection_env as
mosaic_sel_<n>.