Description Usage Arguments Value Examples
View source: R/input-date-range.R
This is a shiny module to create a date range input with presets for the Last 1 week, 2 weeks, 6 months etc.
1 2 3 4 | input_date_range(input, output, session, date_range = c(Sys.Date() - 365,
Sys.Date()), selected_date_range_preset = "Last Year", ...)
input_date_range_ui(id, ...)
|
input |
standard |
output |
standard |
session |
standard |
date_range |
a range of dates |
selected_date_range_preset |
selected date range preset |
... |
additional parameters passed to the module |
id |
a string indicating the id to call the module with |
A reactive vector of the selected date range
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | library(shiny)
## Not run:
shinybones::preview_module(input_date_range, use_box = TRUE)
test_date_range <- function(input, output, session, ...){
ns <- session$ns
date_range_input <- callModule(input_date_range, 'date_range')
output$date_range_text <- renderText({
paste(date_range_input(), collapse = " - ")
})
}
test_date_range_ui <- function(id, ...){
ns <- shiny::NS(id)
shinydashboard::box(
width = 12,
title = 'Date Range Input',
input_date_range_ui(ns('date_range')),
column(12, textOutput(ns('date_range_text')))
)
}
shinybones::preview_module(test_date_range)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.