Learn R Programming

berryFunctions (version 1.18.2)

movAvLines: Moving average with different window widths

Description

Add moving average lines with different window widths to a plot

Usage

movAvLines(x = 1:length(y), y, widths = c(3, 5, 7, 9, 11, 13), weights,
  col = "blue", alpha = 0.3, add = TRUE, las = 1, ...)

Arguments

x

x values of data. DEFAULT: 1:length(y)

y

y values that are smoothed with several window widths

widths

widths of movAv windows. DEFAULT: 2:7*2-1

weights

weights within each window

col

color passed to addAlpha. DEFAULT: "blue"

alpha

transparency passed to addAlpha. DEFAULT: 0.3

add

Logical: Add to existing plot?Set to FALSE to first create the scatterplot. DEFAULT: TRUE

las

LabelAxisStyle (only relevant if add=FALSE). DEFAULT: 1

further arguments passed to lines

See Also

movAv, addAlpha

Examples

Run this code
# NOT RUN {
set.seed(42)
movAvLines(y=cumsum(rnorm(50)), add=FALSE, lwd=3)

# }

Run the code above in your browser using DataLab