plot_time_variation: Function to plot hourly, weekday, and monthly averages.

View source: R/plot_time_variation.R

plot_time_variationR Documentation

Function to plot hourly, weekday, and monthly averages.

Description

Function to plot hourly, weekday, and monthly averages.

Usage

plot_time_variation(
  df,
  by = NA,
  n_min = 2,
  colours = NA,
  ylim = c(NA, NA),
  legend_name = NA,
  y_label = NA,
  normalise = FALSE,
  plot = TRUE
)

Arguments

df

Input data frame with at least two variables, two of which are named value and date.

by

A grouping variable to separately plot different variables.

n_min

How many observations are needed to create a valid confidence interval? By default, at least two observations are needed to avoid very large bounds that results in bad y-axes scales.

colours

A vector of colours to use for the plotting.

ylim

Limits for y-axes.

legend_name

A string to overwrite the default legend label.

y_label

A string to overwrite the default y-axes labels.

normalise

Should the aggregations be normalised by dividing the aggregations by their means? This helps when by is used and the groups have different response scales.

plot

Should the plot be printed?

Value

A list object containing two objects – the first element contains the aggregations that are calculated and plotted and the second contains the plots. The plots are further split into an element that contains the four individual plots and the second is the four plots combined into a single object.

Author(s)

Stuart K. Grange


skgrange/threadr documentation built on Feb. 17, 2025, 9:08 p.m.