regularise_time {studentlife} | R Documentation |
regularise_time
Description
Transform an SL_tibble
(as produced by
load_SL_tibble
)
in such a way that the observations are aggregated in
equal length intervals called 'blocks' (for more
information on blocks see
add_block_labels
).
Usage
regularise_time(
tab,
...,
blocks = c("epoch", "day"),
add_NAs = TRUE,
unsafe = F,
study_duration = getOption("SL_duration"),
start_date = getOption("SL_start"),
epoch_levels = getOption("SL_epoch_levels"),
epoch_ubs = getOption("SL_epoch_ubs"),
uid_range = getOption("SL_uids"),
date_range = seq(from = start_date, by = 1, length.out = study_duration)
)
Arguments
tab |
An |
... |
Arguments passed to |
blocks |
A character vector naming one or more of the
block options "hour_in_day", "epoch", "day", "week", "weekday",
"month" or "date".
If not present as column names in
|
add_NAs |
A logical. If TRUE then NAs will be introduced to fill missing blocks. |
unsafe |
A logical. Default is |
study_duration |
Integer. The duration of the StudentLife
study in days. This parameter does nothing if |
start_date |
Date. The date that the StudentLife study started. |
epoch_levels |
A character vector of epoch labels. |
epoch_ubs |
An integer vector that defines the hour that is the upper boundary of each epoch. |
uid_range |
An integer vector. The range of uids in the StudentLife study. |
date_range |
A vector of dates to be
used if |
Examples
d <- tempdir()
download_studentlife(location = d, url = "testdata")
tab <- load_SL_tibble(
loc = d, schema = "sensing", table = "activity", csv_nrows = 10)
r_tab <- regularise_time(
tab, blocks = c("day","weekday"),
act_inf = max(activity_inference), add_NAs = FALSE)
r_tab