| Type: | Package |
| Title: | Advanced Interactive Data Tables and Data Explorer |
| Version: | 2.0.0 |
| Description: | An advanced, interactive data table and data explorer for R, delivered as a modern, self-contained 'htmlwidget' with a high-performance virtualized grid. ViewR renders 'Kaggle'-style micro-dashboard column headers complete with data-type badges, mini distribution spark-histograms, and data-completeness (missingness) bars. It provides hover metadata cards, a sliding Data Insights drawer with interactive histograms and 'Pareto' category charts, a multi-condition visual query builder (AND/OR), a column visibility picker, and a reproducible code generator that emits 'dplyr', base R, and 'SQL' that matches the active filter and column state. The interface is implemented entirely in dependency-free vanilla 'JavaScript' (no 'React' or build toolchain) and works in the 'RStudio'/'Positron' Viewer, inside 'Shiny' apps, in 'R Markdown'/'Quarto', or as a portable standalone 'HTML' file. A single call to viewr() opens the explorer; the legacy 'Shiny'-gadget ViewR() editor remains available. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| Language: | en-GB |
| Depends: | R (≥ 4.1.0) |
| URL: | https://github.com/itsmdivakaran/viewR, https://itsmdivakaran.github.io/viewR/ |
| BugReports: | https://github.com/itsmdivakaran/viewR/issues |
| Imports: | htmlwidgets (≥ 1.6.0), htmltools (≥ 0.5.4), jsonlite (≥ 1.8.0), shiny (≥ 1.7.0), DT (≥ 0.27), rhandsontable (≥ 0.3.8), shinyjs (≥ 2.1.0), shinythemes (≥ 1.2.0), stats, utils |
| Suggests: | haven, tibble, dplyr, knitr, rmarkdown, testthat (≥ 3.0.0), covr |
| VignetteBuilder: | knitr |
| Config/testthat/edition: | 3 |
| Config/roxygen2/version: | 8.0.0 |
| NeedsCompilation: | no |
| Packaged: | 2026-06-03 15:30:29 UTC; maheshdivakaran |
| Author: | Mahesh Divakaran [aut, cre] |
| Maintainer: | Mahesh Divakaran <imaheshdivakaran@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-06-03 23:10:02 UTC |
ViewR: Advanced Interactive Data Tables and Data Explorer
Description
An advanced, interactive data table and data explorer for R, delivered as a modern, self-contained 'htmlwidget' with a high-performance virtualized grid. ViewR renders 'Kaggle'-style micro-dashboard column headers complete with data-type badges, mini distribution spark-histograms, and data-completeness (missingness) bars. It provides hover metadata cards, a sliding Data Insights drawer with interactive histograms and 'Pareto' category charts, a multi-condition visual query builder (AND/OR), a column visibility picker, and a reproducible code generator that emits 'dplyr', base R, and 'SQL' that matches the active filter and column state. The interface is implemented entirely in dependency-free vanilla 'JavaScript' (no 'React' or build toolchain) and works in the 'RStudio'/'Positron' Viewer, inside 'Shiny' apps, in 'R Markdown'/'Quarto', or as a portable standalone 'HTML' file. A single call to viewr() opens the explorer; the legacy 'Shiny'-gadget ViewR() editor remains available.
Author(s)
Maintainer: Mahesh Divakaran imaheshdivakaran@gmail.com
Authors:
Mahesh Divakaran imaheshdivakaran@gmail.com
See Also
Useful links:
Report bugs at https://github.com/itsmdivakaran/viewR/issues
ViewR: Interactive Data Viewer, Filter, and Editor
Description
Opens a feature-rich, popup-based Shiny interface for viewing, exploring, filtering, sorting, editing, and analysing R data frames. All operations are reflected in real-time as copy-pasteable dplyr code.
Usage
ViewR(
data,
edit = FALSE,
popup = TRUE,
labels = NULL,
title = NULL,
viewer = c("dialog", "browser", "pane"),
generate_code = TRUE,
theme = c("flatly", "cerulean", "cosmo", "darkly", "lumen", "paper", "readable",
"sandstone", "simplex", "spacelab", "united", "yeti"),
max_display = 50000L,
return_data = TRUE,
...
)
Arguments
data |
A |
edit |
Logical. Enable the Excel-like editing tab.
Default |
popup |
Logical. If |
labels |
Optional named character vector of variable labels.
Names must match column names of |
title |
Window title. Defaults to the name of |
viewer |
Where to display the interface:
|
generate_code |
Logical. Show the R Code tab. Default |
theme |
Bootstrap theme for the UI. One of
|
max_display |
Integer. Maximum rows rendered in the Data View table
(for performance). Default |
return_data |
Logical. When the user clicks Done, return the
(possibly edited) data frame. Default |
... |
Reserved for future arguments; currently ignored. |
Value
If return_data = TRUE and the user clicked Done,
returns the modified data frame invisibly. Otherwise returns the
original data frame invisibly.
Features
-
Data View - searchable, paginated DT table with optional variable-label tooltips and column-level search filters.
-
Sidebar Filters - add unlimited filter conditions with operators
==,!=,>,>=,<,<=, contains, starts with, ends with, is NA, is not NA; combine with AND / OR logic. -
Multi-column Sort - add multiple sort levels; choose ascending or descending per column.
-
Column Visibility - show/hide any columns via checkboxes.
-
Excel-like Editor (
edit = TRUE) - powered by rhandsontable; supports in-cell editing, adding rows, and unlimited undo/redo. -
Find & Replace - find literal text or regex across one or all columns with case-sensitivity and exact-match options; preview changes before applying.
-
Variable Info - data type, N, missing min, max, and sample values for every column.
-
R Code Generation - the R Code tab always shows the complete, runnable dplyr pipeline for the current state. One click copies it to the clipboard.
Examples
## Not run:
## -- Basic view ------------------------------------------------------------
ViewR(mtcars)
## -- Edit mode: returns modified data -------------------------------------
new_iris <- ViewR(iris, edit = TRUE)
## -- Custom labels + dark theme --------------------------------------------
ViewR(mtcars,
labels = c(mpg = "Miles per Gallon",
cyl = "Number of Cylinders",
hp = "Gross Horsepower"),
theme = "darkly")
## -- Open in the system browser --------------------------------------------
ViewR(iris, viewer = "browser", generate_code = TRUE)
## -- View a haven-imported dataset (labels read automatically) -------------
# df <- haven::read_sav("my_survey.sav")
# ViewR(df)
## End(Not run)
Install All ViewR Dependencies
Description
Checks which required packages are missing from the user's library and
installs them via install.packages.
Usage
install_viewr_deps(ask = TRUE)
Arguments
ask |
Logical. If |
Value
Invisibly returns a character vector of packages that were (or needed to be) installed.
Examples
## Not run:
install_viewr_deps()
## End(Not run)
Save a ViewR explorer to a standalone HTML file
Description
Exports any data frame as a fully interactive, offline ViewR explorer that runs in any browser without R or an internet connection.
Usage
save_viewdt(
data,
file,
options = viewdt_options(),
selfcontained = TRUE,
title = "ViewR",
dataset_name = NULL,
open = FALSE
)
Arguments
data |
A 'data.frame' or 'tibble' to export. |
file |
Output '.html' path. |
options |
A list created by [viewdt_options()]. |
selfcontained |
Logical. If 'TRUE' (default) bundle all assets into a single file (requires pandoc); if 'FALSE', write a lightweight HTML file plus a companion '_files/' directory (recommended for large data). |
title |
Browser tab title. Default '"ViewR"'. |
dataset_name |
Variable name used in generated code. Defaults to the deparsed 'data' expression. |
open |
Logical. Open the file in a browser after saving (interactive sessions only). Default 'FALSE'. |
Value
The output file path, invisibly.
Examples
## Not run:
save_viewdt(mtcars, "mtcars.html", open = TRUE)
save_viewdt(iris, "iris.html", selfcontained = FALSE)
## End(Not run)
Modern interactive data explorer widget
Description
Opens a high-performance, self-contained data explorer for a data frame. 'viewdt()' profiles every column in R and renders a virtualized grid with “Kaggle”-style micro-dashboard headers (data-type badges, mini spark-histograms, and data-completeness bars), hover metadata cards, a sliding Data Insights drawer, a multi-condition visual query builder, a column-visibility picker, and a reproducible code generator (dplyr, base R, and SQL).
Usage
viewdt(
data,
options = viewdt_options(),
dataset_name = NULL,
width = NULL,
height = NULL,
elementId = NULL
)
Arguments
data |
A 'data.frame' or 'tibble' to explore. |
options |
A list created by [viewdt_options()]. |
dataset_name |
Character used as the data variable name in generated code. Defaults to the deparsed 'data' expression. |
width, height |
Optional widget dimensions; default to a full-container responsive layout. |
elementId |
Optional explicit element id. |
Details
The interface is implemented entirely in dependency-free vanilla JavaScript (no React or build toolchain) and works in the RStudio / Positron Viewer, inside Shiny, in R Markdown / Quarto, or as a portable standalone HTML file via [save_viewdt()].
Value
An 'htmlwidget' object.
Examples
## Not run:
viewdt(mtcars)
viewdt(iris, options = viewdt_options(theme = "dark", hidden_columns = "Species"))
## End(Not run)
Shiny bindings for viewdt
Description
Output and render functions for using [viewdt()] within Shiny applications and interactive R Markdown documents.
Usage
viewdtOutput(outputId, width = "100%", height = "600px")
renderViewdt(expr, env = parent.frame(), quoted = FALSE)
Arguments
outputId |
Output variable to read from. |
width, height |
Must be valid CSS units (e.g. '"100%"') or numbers. |
expr |
An expression that generates a [viewdt()] widget. |
env |
The environment in which to evaluate 'expr'. |
quoted |
Is 'expr' a quoted expression (with 'quote()')? |
Value
'viewdtOutput()' returns a Shiny output UI element; 'renderViewdt()' returns a Shiny render function.
Configure the ViewR data explorer
Description
Builds the option list consumed by [viewdt()] and [save_viewdt()]. Every argument has a sensible default, so 'viewdt_options()' with no arguments returns a fully usable configuration.
Usage
viewdt_options(
theme = c("auto", "light", "dark"),
show_labels = TRUE,
histograms = TRUE,
missing_bars = TRUE,
type_badges = TRUE,
insights = TRUE,
query_builder = TRUE,
column_picker = TRUE,
code_export = TRUE,
global_search = TRUE,
na_string = "NA",
hidden_columns = NULL,
page_size = 200L,
hist_bins = 20L,
top_n = 10L,
max_cells = 5e+06
)
Arguments
theme |
UI appearance: one of '"auto"' (default, follows the host/system colour scheme), '"light"', or '"dark"'. |
show_labels |
Logical. Display variable-label attributes (e.g. as set by haven or clinical ADaM data) inline in the column headers. Default 'TRUE'. |
histograms |
Logical. Render mini spark-histograms / category bars inside the column headers. Default 'TRUE'. |
missing_bars |
Logical. Render the data-completeness (missingness) bar at the bottom of each header. Default 'TRUE'. |
type_badges |
Logical. Show data-type badges in headers. Default 'TRUE'. |
insights |
Logical. Enable the sliding Data Insights drawer. Default 'TRUE'. |
query_builder |
Logical. Enable the multi-condition visual query builder. Default 'TRUE'. |
column_picker |
Logical. Enable the column-visibility picker. Default 'TRUE'. |
code_export |
Logical. Enable the reproducible code generator (dplyr / base R / SQL). Default 'TRUE'. |
global_search |
Logical. Enable the global search box. Default 'TRUE'. |
na_string |
Character. Placeholder shown for missing values. Default '"NA"'. |
|
Character vector of column names hidden on first render. Default 'NULL'. | |
page_size |
Integer. Rows kept in the virtualized DOM buffer. Default '200L'. |
hist_bins |
Integer. Number of bins for numeric histograms. Default '20L'. |
top_n |
Integer. Number of categories profiled for character columns. Default '10L'. |
max_cells |
Integer. Soft safeguard; data frames with more than this many cells ('nrow * ncol') trigger a warning. Default '5e6'. |
Value
A named list of class '"viewdt_options"'.
Examples
viewdt_options(theme = "dark", hidden_columns = c("cyl", "hp"))