tsibble-wrap {tsibbletalk}R Documentation

A shiny module to easily slice and dice tsibble index for visualising periodicity

Description

A pair of UI and server functions: tsibbleWrapUI() and tsibbleWrapServer().

Usage

tsibbleWrapUI(id)

tsibbleWrapServer(id, plot, period)

Arguments

id

A unique shiny id.

plot

A ggplot or plotly object.

period

A string passed to lubridate::period() to specify the minimum seasonal period, for example "1 day".

Examples

if (interactive()) {
  library(tsibble)
  library(dplyr)
  library(shiny)
  library(ggplot2)
  p <- tourism %>%
    filter(Region %in% c("Melbourne", "Sydney")) %>%
    ggplot(aes(x = Quarter, y = Trips, colour = Region)) +
    geom_line() +
    facet_wrap(~ Purpose, scales = "free_y") +
    theme(legend.position = "none")

  ui <- fluidPage(tsibbleWrapUI("dice"))
  server <- function(input, output, session) {
    tsibbleWrapServer("dice", p, period = "1 year")
  }
  shinyApp(ui, server)
}

[Package tsibbletalk version 0.1.0 Index]