stat_ma: Stat for moving avarage

View source: R/stat_ma.R

stat_maR Documentation

Stat for moving avarage

Description

Stat for moving avarage

Usage

stat_ma(mapping = NULL,
  data = NULL,
  geom = "line",
  position = "identity",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE,
  windowsize = NULL,
  stepsize = NULL, ...)

Arguments

mapping

Set of aesthetic mappings created by aes().

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. "jitter" to use position_jitter)

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.

Examples

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)

abikoushi/ggsomestat documentation built on March 21, 2024, 7:03 a.m.