Learn R Programming

climatehealth (version 1.0.0)

plot_moving_average: Plot the moving average of a column.

Description

Plot the moving average of a column.

Usage

plot_moving_average(
  df,
  time_col,
  value_col,
  ma_days,
  ma_sides,
  title,
  save_plot = FALSE,
  output_path = "",
  units = NULL
)

Arguments

df

The dataframe containing the raw data.

time_col

The column name of the column containing the timeseries.

value_col

The column name of the column containing the value.

ma_days

The number of days to use for MA calculations.

ma_sides

The number of sides to use for MA calculations (1 or 2).

title

The title for your plot.

save_plot

Whether or not to save the plot.

output_path

The path to output the plot to.

units

A named character vector of units for each variable.