Description Usage Arguments Value Note Author(s) References See Also Examples
This function returns either a vector of moving averages or the maximum moving average for some input vector x.
1 | movingaves(x, window, return.max = FALSE, skipchecks = FALSE)
|
x |
Input vector. |
window |
Window length for moving averages. |
return.max |
If TRUE, function returns the maximum moving average; if FALSE, function returns a vector of moving averages. |
skipchecks |
If TRUE, function skips error checking code and runs slightly faster. |
Either a single numeric value indicating the maximum moving average, or a vector of length (length(x) - window + 1) with moving averages.
Some additional information on the package accelerometry and its functions can be found on the author's website, https://sites.google.com/site/danevandomelen/
Dane R. Van Domelen
Acknowledgment: This material is based upon work supported by the National Science Foundation Graduate Research Fellowship under Grant No. DGE-0940903.
1 2 3 4 5 6 7 8 9 10 11 | # Load in sample data frame
data(unidata)
# Get data from ID number 21005
counts.part1 <- unidata[unidata[, "seqn"] == 21005, "paxinten"]
# Create vector of all 10-minute moving averages
all.10min.averages <- movingaves(x = counts.part1, window = 10)
# Calculate maximum 10-minute moving average
max.10min.average <- movingaves(x = counts.part1, window = 10, return.max = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.