MyNixOS website logo
Description

Reusable Data Viewer Module for 'shiny'.

Provides a reusable 'shiny' module for viewing tabular data with a searchable 'reactable' table and a variable summary sidebar built with 'bslib'.

shinydataviewer shinydataviewer hex sticker logo

R-CMD-check

shinydataviewer provides a reusable Shiny module for viewing tabular data with a searchable table and a variable summary sidebar inspired by the Positron data viewer.

Screenshot of the shinydataviewer interface

Installation

Install shinydataviewer from CRAN:

install.packages("shinydataviewer")

You can install the development version from GitHub:

pak::pak("Ryan-W-Harrison/shinydataviewer")

Package interface

shinydataviewer is designed to be used as a reusable Shiny module. The main exported functions are:

  • data_viewer_ui(id)
  • data_viewer_server(id, data)
  • data_viewer_card_ui(id, title = NULL)
  • summarize_columns(df)

data should be a reactive expression that returns a data.frame. Supported column classes are numeric, integer, character, factor, logical, Date, and POSIXct/POSIXt.

Minimal module example

Use the module directly when you want the viewer layout to manage its own main table region:

library(shiny)
library(bslib)
library(shinydataviewer)

ui <- page_fillable(
  theme = bs_theme(version = 5),
  data_viewer_ui("viewer")
)

server <- function(input, output, session) {
  data_viewer_server(
    "viewer",
    data = reactive(iris)
  )
}

shinyApp(ui, server)

Embedded card example

Use data_viewer_card_ui() when the viewer needs to live inside a larger dashboard or reporting layout:

library(shiny)
library(bslib)
library(shinydataviewer)

ui <- page_fillable(
  theme = bs_theme(version = 5),
  layout_columns(
    col_widths = c(4, 8),
    card(
      card_header("Context"),
      card_body("Supporting content goes here.")
    ),
    card(
      card_header("Dataset"),
      card_body(
        fill = TRUE,
        data_viewer_card_ui("viewer", title = NULL, full_screen = FALSE)
      )
    )
  )
)

server <- function(input, output, session) {
  data_viewer_server(
    "viewer",
    data = reactive(mtcars)
  )
}

shinyApp(ui, server)

An additional runnable example is included at inst/examples/embedded-card-example.R.

Theming and branding

The viewer styles are attached as a package dependency and use Bootstrap 5 theme variables instead of fixed colors. In practice, that means the module will follow the active bslib theme and should pick up branding supplied through bs_theme() or a brand.yml-driven theme without additional module-specific configuration.

ui <- page_fillable(
  theme = bs_theme(
    version = 5,
    brand = "brand.yml"
  ),
  data_viewer_card_ui("viewer")
)

Data summary helper

If you want access to the same summary data used by the module’s variable panel, you can call summarize_columns() directly:

summarize_columns(iris)

The returned data frame has one row per input column. Its summary_stats and distribution_data list-columns contain the same precomputed payloads used by the sidebar cards, including compact statistics, histogram bins, and top-level categorical counts.

Metadata

Version

0.1.0

License

Unknown

Platforms (80)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows