Learn R Programming

berryFunctions (version 1.9.0)

movAvLines: moving average with different window widths

Description

adds moving average lines with different window widths to a plot

Usage

movAvLines(y, x=1:length(y), widths=2:7*2-1, weights,
col="blue", alpha=0.3, plot=FALSE, las=1, ... )

Arguments

y
y values that are smoothed with several window widths
x
x values of data. DEFAULT: 1:length(y)
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
plot
should scatterplot be created first? DEFAULT: FALSE
las
LabelAxisStyle (only relevant if plot=TRUE). DEFAULT: 1
...
further arguments passed to lines

See Also

movAv, addAlpha

Examples

Run this code
set.seed(42)
movAvLines(cumsum(rnorm(50)), plot=TRUE, lwd=3)

Run the code above in your browser using DataLab