flag_choi | R Documentation |
Apply Choi et al nonwear algorithm
flag_choi( x, activity_threshold = 0, min_period_len = 90, spike_tolerance = 2, min_window_len = 30, window_spike_tolerance = 0, print_output = F )
x |
a numeric vector, no NAs. Values correspond to timestamps for each epoch, note that 1 epoch is 60s. |
activity_threshold |
values below |
min_period_len |
the minimum length of the consecutive zeros that can be considered valid non wear time. Default value is 90 (since we have 60sec epoch data, this equals 90 mins). |
spike_tolerance |
any count that is above the activity threshold is considered a spike. The tolerence defines the number of spikes that are acceptable within a sequence of zeros. The default is 2, meaning that we allow for 2 spikes in the data, i.e. artifactual movement. |
min_window_len |
minimum length of upstream or downstream time window (referred to as window2 in the paper) for consecutive zero counts required before and after the artifactual movement interval to be considered a nonwear time interval. |
window_spike_tolerance |
accepted number of spikes in upstream and downstream windows. |
print_output |
if set to True, then print the output of the non wear sequence, start index, end index, duration, start time, end time and epoch values. Default is False. |
Implements non-wear algorithm closely following that of Choi et al. (2011).
Med Sci Sports Exerc. 2011 Feb;43(2):357-64. doi: 10.1249/MSS.0b013e3181ed61a3. Validation of accelerometer wear and nonwear time classification algorithm. Choi L1, Liu Z, Matthews CE, Buchowski MS.
Code implementation from:https://github.com/shaheen-syed/ActiGraph-ActiWave-Analysis/
nonwear vector, non wear time encoded as T, and wear time encoded as F.
## Not run: minute_data %>% group_by(id) %>% mutate(nonwear = flag_choi(1 - is.na(HR))) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.