stat_ma | R Documentation |
Stat for moving avarage
stat_ma(mapping = NULL,
data = NULL,
geom = "line",
position = "identity",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
windowsize = NULL,
stepsize = NULL, ...)
mapping |
Set of aesthetic mappings created by |
data |
data to be displayed in this layer |
geom |
geometric object to use to display the data |
position |
Position adjustment, either as a string naming the adjustment
(e.g. |
na.rm |
a logical evaluating to TRUE or FALSE indicating whether NA values should be stripped before the computation proceeds. |
show.legend |
logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. It can also be a named logical vector to finely select the aesthetics to display. |
inherit.aes |
The position adjustment to use for overlappling points on this layer |
windowsize |
range to take mean |
stepsize |
step size |
... |
further arguments passed to or from other methods. |
ggplot(economics, aes(date, unemploy)) +
geom_line()+
stat_ma(colour="royalblue", windowsize=300)
ggplot(economics, aes(date, unemploy)) +
geom_line()+
stat_ma(colour="royalblue", windowsize=300, stepsize=150)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.