This function computes, using valid days only, the mean of each of the metrics
obtained using the recap_by_day
function. The median can also
be obtained with an appropriate configuration of the function.
Usage
average_results(data, minimum_wear_time = 10, fun = c("mean", "median"))
Arguments
- data
A dataframe obtained using the
prepare_dataset
,mark_wear_time
,mark_intensity
, and then therecap_by_day
functions.- minimum_wear_time
A numeric value (in hours) to set the minimum wear time duration for validating a day.
- fun
A character value indicating whether means or medians should be computed.
Examples
# \donttest{
file <- system.file("extdata", "acc.agd", package = "activAnalyzer")
mydata <- prepare_dataset(data = file)
mydata_with_wear_marks <- mark_wear_time(
dataset = mydata,
TS = "TimeStamp",
to_epoch = 60,
cts = "vm",
frame = 90,
allowanceFrame = 2,
streamFrame = 30
)
#> frame is 90
#> streamFrame is 30
#> allowanceFrame is 2
mydata_with_intensity_marks <- mark_intensity(
data = mydata_with_wear_marks,
col_axis = "vm",
equation = "Sasaki et al. (2011) [Adults]",
sed_cutpoint = 200,
mpa_cutpoint = 2690,
vpa_cutpoint = 6167,
age = 32,
weight = 67,
sex = "male",
)
#> You have computed intensity metrics with the mark_intensity() function using the following inputs:
#> axis = vm
#> sed_cutpoint = 200 counts/min
#> mpa_cutpoint = 2690 counts/min
#> vpa_cutpoint = 6167 counts/min
#> equation = Sasaki et al. (2011) [Adults]
#> age = 32
#> weight = 67
#> sex = male
summary_by_day <- recap_by_day(
data = mydata_with_intensity_marks,
age = 32,
weight = 67,
sex = "male",
valid_wear_time_start = "07:00:00",
valid_wear_time_end = "22:00:00"
)$df_all_metrics
#> Joining with `by = join_by(date)`
#> Joining with `by = join_by(date)`
#> Joining with `by = join_by(date)`
#> You have computed results with the recap_by_day() function using the following inputs:
#> age = 32
#> weight = 67
#> sex = male
average_results(data = summary_by_day, minimum_wear_time = 10)
#> # A tibble: 1 × 38
#> valid_days wear_time total_counts_axis1 total_counts_vm axis1_per_min
#> <int> <dbl> <dbl> <dbl> <dbl>
#> 1 5 768. 513109. 970345. 687.
#> # ℹ 33 more variables: vm_per_min <dbl>, minutes_SED <dbl>, minutes_LPA <dbl>,
#> # minutes_MPA <dbl>, minutes_VPA <dbl>, minutes_MVPA <dbl>,
#> # percent_SED <dbl>, percent_LPA <dbl>, percent_MPA <dbl>, percent_VPA <dbl>,
#> # percent_MVPA <dbl>, ratio_mvpa_sed <dbl>, mets_hours_mvpa <dbl>,
#> # total_kcal <dbl>, pal <dbl>, total_steps <dbl>, max_steps_60min <dbl>,
#> # max_steps_30min <dbl>, max_steps_20min <dbl>, max_steps_5min <dbl>,
#> # max_steps_1min <dbl>, peak_steps_60min <dbl>, peak_steps_30min <dbl>, …
# }