View source: R/datautilities.R
mav2 | R Documentation |
simple moving average
mav2(dat, lagdat, fill = FALSE)
dat |
A numeric vector |
lagdat |
number of lags for moving average |
fill |
if TRUE fills in NAs to create of vector of original length (default FALSE) |
A numeric vector of length length(dat)-(lagdat+1), or length(dat)
presently cannot handle NA or missing data
x<-c(1:100)
mav2(x, 5)
mav2(x, 10, fill=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.