input_date_range: Create date range input with preset ranges

Description Usage Arguments Value Examples

View source: R/input-date-range.R

Description

This is a shiny module to create a date range input with presets for the Last 1 week, 2 weeks, 6 months etc.

Usage

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, ...)

Arguments

input

standard shiny boilerplate

output

standard shiny boilerplate

session

standard shiny boilerplate

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

Value

A reactive vector of the selected date range

Examples

 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)

ramnathv/shinymetrics documentation built on June 29, 2020, 10:39 p.m.