Usage
moving_average(
db,
sensor,
cols,
n,
participant_id = NULL,
start_date = NULL,
end_date = NULL
)Arguments
- db
A database connection to an m-Path Sense database.
- sensor
The name of a sensor. See sensors for a list of available sensors.
- cols
Character vectors of the columns in the
sensortable to average over.- n
The number of seconds to average over. The index of the result will be centered compared to the rolling window of observations.
- participant_id
A character vector identifying one or multiple participants.
- start_date
Optional search window specifying date where to begin search. Must be convertible to date using as.Date. Use first_date to find the date of the first entry for a participant.
- end_date
Optional search window specifying date where to end search. Must be convertible to date using as.Date. Use last_date to find the date of the last entry for a participant.
Examples
if (FALSE) { # \dontrun{
path <- system.file("testdata", "test.db", package = "mpathsenser")
db <- open_db(NULL, path)
moving_average(
db = db,
sensor = "Light",
cols = c("mean_lux", "max_lux"),
n = 5, # seconds
participant_id = "12345"
)
close_db(db)
} # }
