View source: R/create_day_data.R
summarize_daily_actigraphy | R Documentation |
Summarize Actigraphy Data
summarize_daily_actigraphy(
x,
unit = "1 min",
fix_zeros = TRUE,
fill_in = TRUE,
trim = FALSE,
verbose = TRUE,
calculate_mims = FALSE,
calculate_ac = FALSE,
flag_data = TRUE,
ensure_all_time = TRUE,
flags = NULL,
...
)
summarise_daily_actigraphy(
x,
unit = "1 min",
fix_zeros = TRUE,
fill_in = TRUE,
trim = FALSE,
verbose = TRUE,
calculate_mims = FALSE,
calculate_ac = FALSE,
flag_data = TRUE,
ensure_all_time = TRUE,
flags = NULL,
...
)
summarize_actigraphy(
x,
unit = "1 min",
.fns = list(mean = mean, median = median),
verbose = TRUE,
...
)
collapse_daily_actigraphy(
x,
.fns = list(mean = function(x) mean(x, na.rm = TRUE), median = function(x) median(x,
na.rm = TRUE)),
verbose = TRUE
)
summarise_actigraphy(
x,
unit = "1 min",
.fns = list(mean = mean, median = median),
verbose = TRUE,
...
)
x |
an AccData object. If 'x' is a character, then
|
unit |
units to group the data to take the statistic over |
fix_zeros |
Should |
fill_in |
if |
trim |
if |
verbose |
print diagnostic messages |
calculate_mims |
Should MIMS units be calculated?
Passed to |
calculate_ac |
Should Activity Counts from the |
flag_data |
Should [SummarizedActigraphy::flag_qc()] be run?
It will be executed after |
ensure_all_time |
if |
flags |
the flags to calculate, passed to [SummarizedActigraphy::flag_qc()] |
... |
Additional arguments to pass to
|
.fns |
Functions to apply to each of the selected columns.
See |
A tsibble
object, with 86400 rows,
with one row for each second of the day '24*60*60'.
path = system.file("extdata",
"TAS1H30182785_2019-09-17.gt3x",
package = "SummarizedActigraphy")
x = read_actigraphy(path)
options(digit.secs = 2)
fixed = fix_zeros(x)
daily = summarize_daily_actigraphy(fixed, fix_zeros = FALSE)
average_day = collapse_daily_actigraphy(daily)
## Not run:
average_day = summarize_actigraphy(fixed, fix_zeros = FALSE)
if (requireNamespace("ggplot2", quietly = TRUE)) {
library(magrittr)
average_day %>%
ggplot(aes(x = time, y = ai_mean)) +
geom_line()
average_day %>%
ggplot(aes(x = time, y = ai_median)) +
geom_line()
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.