Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cpsievert/histoslider
A Histogram Slider Input for Shiny
https://github.com/cpsievert/histoslider
histogram r-package react shiny slider ui-components
Last synced: 11 days ago
JSON representation
A Histogram Slider Input for Shiny
- Host: GitHub
- URL: https://github.com/cpsievert/histoslider
- Owner: cpsievert
- License: other
- Created: 2022-06-30T00:04:18.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-05T16:48:00.000Z (about 1 year ago)
- Last Synced: 2024-10-12T21:13:54.187Z (27 days ago)
- Topics: histogram, r-package, react, shiny, slider, ui-components
- Language: R
- Homepage:
- Size: 820 KB
- Stars: 26
- Watchers: 4
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-shiny-extensions - histoslider - A histogram slider input binding for Shiny. Supports creating histograms from numeric, date, and date-time vectors. (UI Components / Special Input)
README
# histoslider
[![CRAN
status](https://www.r-pkg.org/badges/version/histoslider)](https://cran.r-project.org/package=histoslider)
[![Lifecycle:
experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html)
[![R build
status](https://github.com/cpsievert/histoslider/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/cpsievert/histoslider/actions)A Shiny input binding wrapper for the [histoslider](https://github.com/samhogg/histoslider) React component.
## Installation
Install the stable release of `histoslider` on CRAN:
```r
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()`.
``` r
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.gif)
An `input_histoslider()` can also be updated programmatically via `update_histoslider()`. For example usage, see the [`inst/examples`](https://github.com/cpsievert/histoslider/tree/main/inst/examples) folder.