| sl_python_modules_installed | R Documentation |
Estimate Sleep from Wrist-Worn Accelerometry
sl_python_modules_installed(component = c("models", "features"))
estimate_sleep(data, epoch = 30L, model_dir, cores = 1L)
component |
Python dependency set to check. The default, |
data |
A |
epoch |
Time in seconds for the time interval estimate |
model_dir |
path to the folder with models from \Sexpr[results=rd]{tools:::Rd_expr_doi("10.5281/zenodo.3752645")} |
cores |
Number of workers to use for model prediction. Any non-zero
integer accepted by Python |
A tibble of times and classification of category.
if (sl_python_modules_installed("models")) {
models = sl_example_model()
if (!is.null(models) && requireNamespace("readr", quietly = TRUE)) {
file = system.file("extdata", "example_data.csv.gz", package = "sleeper")
data = readr::read_csv(file, n_max = 3600L)
# Two minutes is sufficient to demonstrate the workflow and avoids
# applying the forest to the full 12-hour example recording.
try({estimate_sleep(data, model_dir = dirname(models$binary[1]))})
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.