| Title: | Interactive Virtualized Data Explorer Grid Widget |
| Version: | 0.1.0 |
| Description: | Provides an interactive, virtualized data explorer widget for 'R'. Built on 'React' (via 'reactR') and 'htmlwidgets', it offers column-type detection, multi-value checkbox filtering, sorting, column visibility toggling, virtual scrolling for large datasets, and a full-viewport modal. Includes 'dtsmartr_launch()' with an interactive, zero-code file upload wizard using 'datamods'. Widgets can be embedded in 'R Markdown' / 'Quarto' documents, 'Shiny' applications, or exported as standalone HTML files via 'save_dtsmartr()'. |
| License: | MIT + file LICENSE |
| URL: | https://github.com/wagh-nikhil/dtsmartr |
| BugReports: | https://github.com/wagh-nikhil/dtsmartr/issues |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.3 |
| Imports: | datamods, htmltools, htmlwidgets, jsonlite, reactR, shiny, tools, utils |
| Suggests: | bslib, pharmaverseadam, rmarkdown, testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| NeedsCompilation: | no |
| Packaged: | 2026-06-09 11:22:32 UTC; hp |
| Author: | Nikhil Wagh [aut, cre] |
| Maintainer: | Nikhil Wagh <nmw1986@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-06-16 20:30:02 UTC |
dtsmartr - Interactive virtualized data explorer grid widget
Description
Renders a high-performance, virtualized data grid powered by React to explore datasets, filter dynamically, and generate reproducible queries.
Usage
dtsmartr(
data,
width = NULL,
height = NULL,
elementId = NULL,
datasetName = NULL,
options = dtsmartr_options(),
skip_routing = FALSE
)
Arguments
data |
A |
width |
Widget width. Defaults to |
height |
Widget height. Defaults to |
elementId |
CSS ID for the widget container. |
datasetName |
Custom string name representing the dataset in generated reproducible code. If omitted, automatically extracts the R variable name. |
options |
Named list of UI options generated by |
skip_routing |
Logical. Internal flag used by |
Value
An object of class htmlwidget (and sub-class dtsmartr) representing
the interactive virtualized grid. In interactive R sessions, this will
display the explorer in the RStudio/Positron Viewer pane or system browser.
Examples
if (interactive()) {
dtsmartr(mtcars, options = dtsmartr_options(hidden_columns = "cyl"))
}
Shiny bindings for dtsmartr
Description
Output and render functions for using dtsmartr within Shiny applications and interactive Rmd documents.
Usage
dtsmartrOutput(outputId, width = "100%", height = "400px")
renderDtsmartr(expr, env = parent.frame(), quoted = FALSE)
Arguments
outputId |
output variable to read from |
width, height |
Must be a valid CSS unit (like |
expr |
An expression that generates a dtsmartr |
env |
The environment in which to evaluate |
quoted |
Is |
Value
dtsmartrOutput returns a Shiny output element of class shiny.tag.list
that can be placed in a Shiny user interface.
renderDtsmartr returns a Shiny render function of class shiny.render.function
that can be assigned to an output slot.
Launch the dtsmartr Data Explorer in your default Web Browser
Description
Launches a temporary, lightweight Shiny server in the background and opens the
interactive grid in your default external web browser. This bypasses local
browser origin security policies (CORS) that block file:// resources.
Usage
dtsmartr_launch(data = NULL, port = NULL, options = dtsmartr_options())
Arguments
data |
A |
port |
Optional port number. If |
options |
Named list of UI options generated by |
Details
Zero-Code Ingestion Wizard (Wizard Mode)
When data = NULL (default), the Shiny server boots into Wizard Mode. An
interactive interface (powered by the datamods package) allows users to
upload local files (CSV, Excel, SAS, RDS). It also features direct "View"
and "Update" panels to verify and customize columns or variable classes
before loading.
Once a file is successfully uploaded and confirmed, the wizard parses the dataset and feeds it directly into the React-powered virtualized grid explorer.
Value
No return value, called for the side effect of starting a local background Shiny application and opening it in the default web browser.
Examples
if (interactive()) {
# 1. Launch wizard mode to upload local files
dtsmartr_launch()
# 2. Launch directly with a dataset
dtsmartr_launch(mtcars)
}
Generate Configuration Options for dtsmartr
Description
Helper function to specify UI customization, initial grid visibility states, and rendering options for the dtsmartr interactive grid widget.
Usage
dtsmartr_options(
advanced_filter = TRUE,
show_labels = TRUE,
column_picker = TRUE,
allow_export = TRUE,
theme = "auto",
na_string = "NA",
hidden_columns = NULL
)
Arguments
advanced_filter |
Logical. If |
show_labels |
Logical. If |
column_picker |
Logical. If |
allow_export |
Logical. If |
theme |
Character. Specifies the UI color theme: |
na_string |
Character. Custom string placeholder displayed in cells with missing values ( |
|
Character vector. Vector of column names to hide by default on initial widget rendering. |
Value
A named list of validated configuration settings.
Examples
dtsmartr_options(advanced_filter = FALSE, hidden_columns = c("STUDYID", "USUBJID"))
Save a dtsmartr widget to an HTML file
Description
Exports any data.frame as a fully interactive, standalone HTML file powered
by the dtsmartr widget. The resulting file can be opened in any modern web
browser without an active R session or internet connection, making it ideal
for offline use and sharing with collaborators.
Usage
save_dtsmartr(
data,
file,
selfcontained = TRUE,
title = "dtsmartr",
open = FALSE,
background = "white",
libdir = NULL,
width = NULL,
height = NULL,
elementId = NULL,
options = dtsmartr_options(),
verbose = TRUE
)
Arguments
data |
A |
file |
Character string. Path to the output HTML file. The |
selfcontained |
Logical. When |
title |
Character string. Browser tab / window title for the saved HTML
page. Defaults to |
open |
Logical. When |
background |
Character string. CSS colour for the page background.
Defaults to |
libdir |
Character string or |
width |
Numeric or |
height |
Numeric or |
elementId |
Character string or |
options |
Named list of UI options generated by |
verbose |
Logical. When |
Details
Selfcontained vs. non-selfcontained
selfcontained | Output | Best for |
TRUE (default) | Single .html file | Email / sharing |
FALSE | .html + _files/ folder | Local use / large datasets |
File size
Self-contained files embed the React runtime and widget code (~120 KB
gzipped) along with the data. For very large datasets (> 100 k rows) or
when generating many files, prefer selfcontained = FALSE.
Browser compatibility
The generated HTML works in all modern browsers (Chrome, Firefox, Edge, Safari 14+). No internet connection is required.
Value
The absolute path to the saved HTML file, invisibly.
See Also
dtsmartr() for creating the widget object interactively,
htmlwidgets::saveWidget() for the underlying save mechanism.
Examples
# == Basic usage =============================================================
# Save mtcars as a self-contained HTML (single portable file)
tmp_file <- tempfile(fileext = ".html")
save_dtsmartr(mtcars, tmp_file)
# Open in the browser right after saving
tmp_file_open <- tempfile(fileext = ".html")
save_dtsmartr(mtcars, tmp_file_open, open = TRUE)
# == Custom options ==========================================================
tmp_file_opts <- tempfile(fileext = ".html")
save_dtsmartr(
mtcars,
tmp_file_opts,
options = dtsmartr_options(hidden_columns = "cyl", advanced_filter = FALSE)
)