| Title: | Interactive Dataset Explorer for 'R' and 'SAS' and Other Data Formats |
|---|---|
| Description: | A 'Shiny' application that provides nice interface for browsing, exploring, summarising, and converting datasets stored in 'SAS' (.sas7bdat, .xpt), CSV (.csv), and 'R' (.rds) formats. Users can register multiple directory-based libraries, interactively filter data using 'dplyr' expressions, inspect per-variable statistics, and export datasets to Excel, JSON, CSV, 'R' data, or 'SAS' transport formats. |
| Authors: | Ram Gaduputi [aut, cre], Jagadish Katam [aut] |
| Maintainer: | Ram Gaduputi <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.1 |
| Built: | 2026-05-12 14:10:40 UTC |
| Source: | https://github.com/ramsas88/quickexplore |
Generates reproducible R code that mirrors the current QuickExplore session
and provides clipboard-copy (via JS) and download-as-.R handlers.
code_generator_server( id, selected_dataset, filter_expr, selected_vars, group_var, summary_vars, output_format, csv_delim, json_pretty, crosstab_row = shiny::reactive(""), crosstab_col = shiny::reactive(""), crosstab_strat = shiny::reactive("") )code_generator_server( id, selected_dataset, filter_expr, selected_vars, group_var, summary_vars, output_format, csv_delim, json_pretty, crosstab_row = shiny::reactive(""), crosstab_col = shiny::reactive(""), crosstab_strat = shiny::reactive("") )
id |
Character string. The Shiny module namespace identifier. |
selected_dataset |
A |
filter_expr |
A reactive expression returning the dplyr filter string
typed in the Explore Data tab (may be |
selected_vars |
A reactive expression returning a character vector of
variable names chosen in the Explore Data tab (may be |
group_var |
A reactive expression returning the grouping variable name
selected in the Summary panel ( |
summary_vars |
A reactive expression returning variable names used for
summary statistics ( |
output_format |
A reactive expression returning the converter output
format: |
csv_delim |
A reactive returning the CSV delimiter character
(default |
json_pretty |
A reactive returning |
crosstab_row |
A reactive returning the cross-tab row variable name
( |
crosstab_col |
A reactive returning the cross-tab column variable name
( |
crosstab_strat |
A reactive returning the stratification variable name
( |
NULL (invisibly). Called for side effects.
Renders a panel displaying auto-generated R code that reproduces the
current QuickExplore session (load dataset -> filter/select -> summarise
-> export). Users can copy the code to the clipboard or download it as
a .R script.
code_generator_ui(id)code_generator_ui(id)
id |
Character string. The Shiny module namespace identifier. |
A shiny::tagList() with the code generator UI.
Returns value frequencies and percentages for each non-numeric variable
in vars, optionally grouped by a second variable.
compute_categorical_summary(df, vars, group_var = NULL)compute_categorical_summary(df, vars, group_var = NULL)
df |
A |
vars |
Character vector of variable names to summarise. |
group_var |
Optional character string naming a grouping variable.
Pass |
A data.frame with columns for the grouping variable (if any),
the value, its frequency count, percentage, and the variable name.
Returns NULL if there are no categorical variables in vars.
df <- data.frame(sex = c("M","F","M","F","M"), trt = c("A","A","B","B","A")) compute_categorical_summary(df, c("sex", "trt"))df <- data.frame(sex = c("M","F","M","F","M"), trt = c("A","A","B","B","A")) compute_categorical_summary(df, c("sex", "trt"))
Produces a wide-format contingency table of row_var (rows) by col_var
(columns), including row and column totals. When a strat_var is supplied
the table is computed separately for each level of the stratification
variable and the results are stacked with a leading Stratum column.
compute_crosstab(df, row_var, col_var, strat_var = NULL)compute_crosstab(df, row_var, col_var, strat_var = NULL)
df |
A |
row_var |
Character string. Name of the row variable (e.g. |
col_var |
Character string. Name of the column variable (e.g. |
strat_var |
Character string or |
Missing values in any of the three variables are displayed as "(Missing)"
rather than being silently dropped, so analysts can spot incomplete records.
A data.frame in wide format:
Column 1 (or 2 if stratified): row_var levels plus a "Total" row.
Middle columns: one column per col_var level.
Last column: Total (row sums).
If strat_var is given, a leading Stratum column identifies
each stratum. A grand-total block across all strata is not
appended automatically — compute the unstratified table for that.
df <- data.frame( SEX = c("M","F","M","F","M","F"), RACE = c("White","White","Black","Asian","Black","White"), TRT = c("A","A","B","B","A","B") ) compute_crosstab(df, "SEX", "RACE") compute_crosstab(df, "SEX", "RACE", strat_var = "TRT")df <- data.frame( SEX = c("M","F","M","F","M","F"), RACE = c("White","White","Black","Asian","Black","White"), TRT = c("A","A","B","B","A","B") ) compute_crosstab(df, "SEX", "RACE") compute_crosstab(df, "SEX", "RACE", strat_var = "TRT")
Returns a tidy data frame with N, mean, median, standard deviation,
minimum, and maximum for each numeric variable in vars.
compute_numeric_summary(df, vars, group_var = NULL)compute_numeric_summary(df, vars, group_var = NULL)
df |
A |
vars |
Character vector of variable names to summarise. |
group_var |
Optional character string naming a grouping variable.
Pass |
A data.frame (one row per variable, or per variable × group level)
or NULL if there are no numeric variables in vars.
df <- data.frame(x = rnorm(100), y = runif(100), g = rep(c("A", "B"), 50)) compute_numeric_summary(df, c("x", "y")) compute_numeric_summary(df, c("x", "y"), group_var = "g")df <- data.frame(x = rnorm(100), y = runif(100), g = rep(c("A", "B"), 50)) compute_numeric_summary(df, c("x", "y")) compute_numeric_summary(df, c("x", "y"), group_var = "g")
Handles the dataset-conversion download for all supported output formats:
.rds, .xlsx, .csv, .json, and SAS transport .xpt.
converter_server(id, loaded_data, selected_dataset)converter_server(id, loaded_data, selected_dataset)
id |
Character string. The Shiny module namespace identifier. |
loaded_data |
A |
selected_dataset |
A |
A named list with three elements:
output_formatA shiny::reactive() returning the selected output format string.
csv_delimA shiny::reactive() returning the CSV delimiter character.
json_prettyA shiny::reactive() returning TRUE to pretty-print JSON output.
Renders a two-column card layout: a conversion form on the left and a format-reference table plus output preview on the right.
converter_ui(id)converter_ui(id)
id |
Character string. The Shiny module namespace identifier. |
A shiny::tagList() with the converter UI.
Handles data display, filtering, variable inspection, and download for the Data Viewer tab.
data_viewer_server(id, loaded_data, selected_dataset)data_viewer_server(id, loaded_data, selected_dataset)
id |
Character string. The Shiny module namespace identifier. |
loaded_data |
A |
selected_dataset |
A |
A named list with three elements:
filtered_dataA shiny::reactiveVal() with the current filtered data.frame.
filter_exprA shiny::reactive() returning the raw filter expression string.
selected_varsA shiny::reactive() returning the selected variable names.
Creates a tabbed panel with three sub-tabs: an interactive data table (Data Viewer), a filter/subset interface (Explore Data), and a variable metadata explorer (Variables).
data_viewer_ui(id)data_viewer_ui(id)
id |
Character string. The Shiny module namespace identifier. |
A shiny::tagList() with the viewer UI.
Handles library registration, dataset listing, and dataset loading for the sidebar browser panel.
dataset_browser_server(id, selected_dataset, loaded_data)dataset_browser_server(id, selected_dataset, loaded_data)
id |
Character string. The Shiny module namespace identifier. |
selected_dataset |
A |
loaded_data |
A |
A list of reactive values: libraries (named list of
library-path pairs) and selected_library (the currently active library
name).
Renders the sidebar panel that lets users add/remove directory-based libraries and select a dataset to load.
dataset_browser_ui(id)dataset_browser_ui(id)
id |
Character string. The Shiny module namespace identifier. |
A shiny::tagList() containing the sidebar UI elements.
Format a file size in bytes as a human-readable string
format_file_size(size)format_file_size(size)
size |
Numeric. File size in bytes. |
A character string such as "1.4 MB" or "340 KB".
format_file_size(1048576) # "1 MB" format_file_size(512) # "512 B"format_file_size(1048576) # "1 MB" format_file_size(512) # "512 B"
Returns file-level metadata including the number of rows and columns, file size, and timestamps.
get_dataset_metadata(df, filepath)get_dataset_metadata(df, filepath)
df |
A |
filepath |
Character string. Path to the source file. |
A named list with elements: filename, filepath, format,
n_rows, n_cols, file_size, modified, and created.
## Not run: df <- read_dataset("/data/demog.csv") meta <- get_dataset_metadata(df, "/data/demog.csv") meta$n_rows ## End(Not run)## Not run: df <- read_dataset("/data/demog.csv") meta <- get_dataset_metadata(df, "/data/demog.csv") meta$n_rows ## End(Not run)
Returns a data frame describing each variable: its type, SAS label, SAS format, missing value counts, and number of unique values.
get_variable_info(df)get_variable_info(df)
df |
A |
A data.frame with columns Variable, Type, Label, Format,
Missing_Count, Missing_Pct, and N_Unique. As of 0.1.1,
N_Unique counts distinct non-missing values, consistent with
skimr and DataExplorer; the missing count is reported separately
in Missing_Count.
df <- data.frame(x = 1:5, y = letters[1:5]) get_variable_info(df)df <- data.frame(x = 1:5, y = letters[1:5]) get_variable_info(df)
Scans a directory for files with extensions .sas7bdat, .xpt, .csv,
or .rds (case-insensitive) and returns a summary data frame.
list_datasets(dirpath)list_datasets(dirpath)
dirpath |
Character string. Path to the directory to scan. |
A data.frame with columns Name, Format, Size, Modified,
and Path. Returns an empty data frame if no supported files are found.
## Not run: datasets <- list_datasets("/data/mylib") ## End(Not run)## Not run: datasets <- list_datasets("/data/mylib") ## End(Not run)
Dispatches to the appropriate reader based on the file extension.
Supported formats: .sas7bdat, .xpt, .csv, .rds.
read_dataset(filepath)read_dataset(filepath)
filepath |
Character string. Full path to the dataset file. |
For SAS formats (.sas7bdat, .xpt), blank strings are automatically
converted to NA after loading. This matches SAS behaviour where a
blank character value is treated as a system-missing value, not as a
valid empty string.
A data.frame (or tibble) with the dataset contents. For SAS
formats, all-whitespace character values are coerced to NA_character_.
## Not run: df <- read_dataset("/data/mylib/demog.sas7bdat") df <- read_dataset("/data/exports/study.csv") ## End(Not run)## Not run: df <- read_dataset("/data/mylib/demog.sas7bdat") df <- read_dataset("/data/exports/study.csv") ## End(Not run)
Opens the interactive Dataset Explorer in your default web browser (or the RStudio Viewer pane when called from within RStudio). The application provides a SAS Studio-style interface for browsing libraries, exploring datasets, computing summary statistics, and converting between data formats.
run_app(...)run_app(...)
... |
Additional arguments passed to |
Called for its side effect of launching a Shiny application.
Returns NULL invisibly.
## Not run: # Launch with default settings run_app() # Launch on a specific port without opening a browser run_app(port = 4321, launch.browser = FALSE) ## End(Not run)## Not run: # Launch with default settings run_app() # Launch on a specific port without opening a browser run_app(port = 4321, launch.browser = FALSE) ## End(Not run)
Computes and renders descriptive statistics for numeric and categorical variables, plus a missing-value summary table.
summary_panel_server(id, loaded_data)summary_panel_server(id, loaded_data)
id |
Character string. The Shiny module namespace identifier. |
loaded_data |
A |
A named list with two elements:
summary_varsA shiny::reactive() returning the selected variable names.
group_varA shiny::reactive() returning the grouping variable name ("" = none).
Renders the summary statistics panel with dataset overview cards plus tables for numeric, categorical, and missing-value statistics.
summary_panel_ui(id)summary_panel_ui(id)
id |
Character string. The Shiny module namespace identifier. |
A shiny::tagList() with the summary UI elements.