Description Usage Arguments Details Value Author(s) Examples
View source: R/time_series_control_charts.R
Takes in data that has been aggregated to the day level and makes a calendar heatmap.
1 2 3 4 5 6 7 8 9 | ts_calendar_heatmap_plt(
.data,
.date_col,
.value_col,
.low = "red",
.high = "green",
.plt_title = "",
.interactive = TRUE
)
|
.data |
The time-series data with a date column and value column. |
.date_col |
The column that has the datetime values |
.value_col |
The column that has the values |
.low |
The color for the low value, must be quoted like "red". The default is "red" |
.high |
The color for the high value, must be quoted like "green". The default is "green" |
.plt_title |
The title of the plot |
.interactive |
Default is TRUE to get an interactive plot using |
The data provided must have been aggregated to the day level, if not funky output could result and it is possible nothing will be output but errors. There must be a date column and a value column, those are the only items required for this function to work.
This function is intentionally inflexible, it complains more and does less in order to force the user to supply a clean data-set.
A ggplot2 plot or if interactive a plotly plot
Steven P. Sanderson II, MPH
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | library(LICHospitalR)
library(tidyverse)
library(timetk)
library(lubridate)
library(zoo)
library(scales)
data_tbl <- ts_ed_arrivals_query() %>%
ts_ed_arrivals_tbl(.date_col = date_col, .by_time = "day") %>%
filter_by_time(.date_var = date_col, .start_date = "2021") %>%
set_names("date_col","value")
ts_calendar_heatmap_plt(
.data = data_tbl
, .date_col = date_col
, .value_col = value
)
ts_calendar_heatmap_plt(
.data = data_tbl
, .date_col = date_col
, .value_col = value
, .interactive = FALSE
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.