blockaves: Block Average Calculator

Description Usage Arguments Value Note Author(s) References See Also Examples

Description

This function returns averages for non-overlapping segments of data.

Usage

1
blockaves(x, window, skipchecks = FALSE)

Arguments

x

Input vector.

window

Window length.

skipchecks

If TRUE, function skips error checking code and runs slightly faster.

Value

Vector of length floor(length(x) / window)

Note

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/

Author(s)

Dane R. Van Domelen

References

Acknowledgment: This material is based upon work supported by the National Science Foundation Graduate Research Fellowship under Grant No. DGE-0940903.

See Also

movingaves

Examples

 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)

accelerometry documentation built on May 2, 2019, 5:23 p.m.