View source: R/get_valid_day_flag.R
get_valid_day_flag | R Documentation |
Compute valid/non-valid day flag (1
/0
) for each minute of activity
counts data.
get_valid_day_flag(wear_flag, validday_nonwear_maximum_window = 144)
wear_flag |
An integer vector. The vector has value Vector |
validday_nonwear_maximum_window |
In integer scalar. Maxmimum number of minutes of non-wear/not
collecting data so as the day is still considered valid. Default is |
All minute-level observations
from one day are assigned the same value of valid day flag.
The flag is 1
if a day is
determined to be valid, and 0
otherwise.
A day is determined to be valid if it has no more than
validday_nonwear_maximum_window
minutes of missing data.
Data may be missing due to
identified sensor nonwear or because activity data collection has not started
yet/has finished already in a particular day.
An integer vector. It has value 1
if a minute
belongs to a valid day, and 0
otherwise.
## Read exemplary data fpath_i <- system.file("extdata", extdata_fnames[1], package = "arctools") dat_i <- as.data.frame(data.table::fread(fpath_i)) acc <- dat_i$vectormagnitude acc_ts <- lubridate::ymd_hms(dat_i$timestamp) ## Get acc data vector in "midnight_to_midnight" format acc <- midnight_to_midnight(acc, acc_ts) ## Get wear/non-wear flag wear_flag <- get_wear_flag(acc) ## Get valid/non-valid day flag valid_day_flag <- get_valid_day_flag(wear_flag)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.