View source: R/apply-sadeh-algo.R
| apply_sadeh_algo | R Documentation |
This function uses the Sadeh algorithm (https://pubmed.ncbi.nlm.nih.gov/7939118) to classify an accelerometer axis vector of 60-second epochs as sleep time or awake time.
apply_sadeh_algo(
x,
axis1 = "axis1",
censor_counts = FALSE,
return = "everything"
)
x |
Required: a data frame of accelerometer data. |
axis1 |
Required default ( |
censor_counts |
Optional (default: |
return |
Required (default: |
Returns x along with all vectors that were derived while applying
the Sadeh algorithm. Note: values in the sadeh_sleep_score vector that are
greater than -4 are interpreted as sleep time
(see https://actigraphcorp.my.site.com/support/s/article/Where-can-I-find-documentation-for-the-Sadeh-and-Cole-Kripke-algorithms). # nolint: line_length_linter.
# Initialize agd_worker R6 class
agd_data <- agd_worker$new(
id = "jane-canuck",
age = 10,
agd_lfe = system.file("extdata", "jane-canuck-lfe.agd", package = "chms"),
agd_nml = system.file("extdata", "jane-canuck-nml.agd", package = "chms"),
epoch_length = 15,
day_max = 3,
sleep_algo = "barreira",
non_wear_algo = "barreira"
)
# Load and clean data
agd_data$load()$clean()
# Apply Sadeh sleep algorithm
dt <- apply_sadeh_algo(
x = agd_data$data$clean |>
dplyr::filter(
epoch_length == 60,
filter == "LowFrequencyExtension"
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.