A Histogram Slider Input for 'Shiny'

A histogram slider input binding for use in 'Shiny'. Currently supports creating histograms from numeric, date, and 'date-time' vectors.


histoslider

CRANstatus Lifecycle:experimental R buildstatus

A Shiny input binding wrapper for the histoslider React component.

Installation

Install the stable release of histoslider on CRAN:

install.packages("histoslider")

Example usage

input_histoslider() currently supports creating histogram sliders from numeric, date, datetime vectors. The histogram bins may be customized through the breaks argument of an implicit call to hist().

library(shiny)
library(histoslider)

numerics <- rnorm(100)
dates <- sample(
  seq(as.Date('2020-01-01'), as.Date('2030-01-01'), by = "1 month"),
  size = 500, replace = TRUE
)

datetimes <- sample(
  seq(as.POSIXct('2020-01-01 00:01'), as.POSIXct('2030-01-01 00:01'), by = "1 month"),
  size = 500, replace = TRUE
)

ui <- bslib::page_fixed(
  input_histoslider("numeric", "Numeric", numerics, start = -1, end = 1),
  input_histoslider("date", "Date", dates, breaks = 15),
  input_histoslider("datetime", "Date Time", datetimes),
  verbatimTextOutput("values")
)

server <- function(input, output) {
  output$values <- renderPrint({
    str(list(
      numeric = input$numeric,
      date = input$date,
      datetime = input$datetime
    ))
  })
}

shinyApp(ui, server)

https://i.imgur.com/XhVNGCf.gifv

An input_histoslider() can also be updated programmatically via update_histoslider(). For example usage, see the inst/examples folder.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("histoslider")

0.1.1 by Carson Sievert, 3 years ago


Browse source code at https://github.com/cran/histoslider


Authors: Carson Sievert [cre, aut] , Samuel Hogg [ctb, cph] (Original author of histoslider React component)


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports rlang, htmltools, reactR, shiny

Suggests testthat, shinytest2, bslib


See at CRAN