Skip to contents

Plot out the excess +/- of the median value grouped by certain time parameters.

Usage

ts_median_excess_plt(
  .data,
  .date_col,
  .value_col,
  .x_axis,
  .ggplot_group_var,
  .years_back
)

Arguments

.data

The data that is being analyzed, data must be a tibble/data.frame.

.date_col

The column of the tibble that holds the date.

.value_col

The column that holds the value of interest.

.x_axis

What is the be the x-axis, day, week, etc.

.ggplot_group_var

The variable to group the ggplot on.

.years_back

How many yeas back do you want to go in order to compute the median value.

Value

A ggplot2 plot

Details

  • Supply data that you want to view and you will see the excess +/- of the median values over a specified time series tibble.

Examples


suppressPackageStartupMessages(library(timetk))

ts_signature_tbl(
  .data       = m4_daily
  , .date_col = date
) %>%
ts_median_excess_plt(
  .date_col           = date
  , .value_col        = value
  , .x_axis           = month
  , .ggplot_group_var = year
  , .years_back       = 1
)
#> pad applied on the interval: day
#> Joining with `by = join_by(month)`
#> Warning: The `<scale>` argument of `guides()` cannot be `FALSE`. Use "none" instead as
#> of ggplot2 3.3.4.
#>  The deprecated feature was likely used in the healthyR package.
#>   Please report the issue at <https://github.com/spsanderson/healthyR/issues>.
#> Warning: Removed 261 rows containing missing values (`geom_line()`).