Block Average Calculator
This function returns averages for non-overlapping segments of data.
If TRUE, function skips error checking code and runs slightly faster.
Vector of length floor(length(x) / window)
If length(x) is not an exact multiple of window, the average for the last partial segment of data is dropped.
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
# Load in sample data frame data(unidata) # Get data from ID number 21005, Saturday only counts.saturday <- unidata[unidata[, "seqn"] == 21005 & unidata[, "paxday"] == 7, "paxinten"] # Calculate and plot hourly count averages hourly.averages <- blockaves(x = counts.saturday, window = 60) plot(hourly.averages)