Description Usage Arguments Details Value See Also Examples
Calculates rolling mean with stats::filter(y, filter = rep(1/span, span) and adding smooth line with geom_smooth(method = "loess").
1 | ggts_w_rol_mean(data, time = Year_Month, y = count, span)
|
data |
data.frame with x (e.g. time line) and y data to be displayed, e.g. ggplot_w_rol_mean(weather_long, Year_Month, Temperature, span = span). time : numeric string (also of data and Time classes) as index for column name. y : numeric string as index for y column name. |
time |
data frame column for values of x axes. |
y |
data frame column for values of y axes. |
span |
integer width of the rolling window. |
The data input must be a valid data.frame.
data input format (e.g. Month in long format)
Year_Month ... count
<mth> ... <dbl>
1 1890 Jan ... 2.8
2 1890 Feb ... -1.7
:
n 2019 Dec ... 1.4
plot object of mode 'plot
stats::filter and ggplot2::ggplot
1 | ggts_w_rol_mean(ggplot2::economics, date, uempmed, span = 7)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.