add_block_labels {studentlife} | R Documentation |
add_block_labels
Description
Classify observations from an SL_tibble
into block labels using available
date-time information. See more information
about "blocks" under the details section.
Daylight savings is ignored, and started on 31st March 2013.
Usage
add_block_labels(
tab,
type = c("hour_in_day", "epoch", "day", "week", "weekday", "month", "date"),
interval = "start",
warning = TRUE,
start_date = getOption("SL_start"),
epoch_levels = getOption("SL_epoch_levels"),
epoch_ubs = getOption("SL_epoch_ubs"),
unsafe = F
)
Arguments
tab |
An |
type |
A character vector of block label types to include. Can be one or more of "epoch", "day", "week", "weekday", "month" and "date". Any block label types that are not inferrable from the available date-time data are ignored. |
interval |
A character string that decides how block
membership is decided when |
warning |
Logical. If |
start_date |
Date. The date that the StudentLife study started. |
epoch_levels |
A character vector of epoch levels. |
epoch_ubs |
An integer vector that defines the hour that is the upper boundary of each epoch. |
unsafe |
A logical. Default is |
Details
Block label types can be one or more of "epoch"
(giving labels morning, evening, afternoon and night),
"day" (giving number of days since the start_date
of the
StudentLife study),
"week" (giving integer number of weeks since the first week of the
StudentLife study, rounded downs),
"weekday" (giving the day of the week),
"month" (giving integer number of months since the start of the
StudentLife study, rounded down) and "date".
Examples
d <- tempdir()
download_studentlife(location = d, url = "testdata")
tab <- load_SL_tibble(
loc = d, schema = "sensing", table = "activity", csv_nrows = 10)
b_tab <- add_block_labels(tab)
b_tab