Title: | A 'Shiny' App to Analyze Accelerometer-Measured Daily Physical Behavior Data |
---|---|
Description: | A tool to analyse 'ActiGraph' accelerometer data and to implement the use of the PROactive Physical Activity in COPD (chronic obstructive pulmonary disease) instruments. Once analysis is completed, the app allows to export results to .csv files and to generate a report of the measurement. All the configured inputs relevant for interpreting the results are recorded in the report. In addition to the existing 'R' packages that are fully integrated with the app, the app uses some functions from the 'actigraph.sleepr' package developed by Petkova (2021) <https://github.com/dipetkov/actigraph.sleepr/>. |
Authors: | Pierre-Yves de Müllenheim [cre, aut]
|
Maintainer: | Pierre-Yves de Müllenheim <[email protected]> |
License: | GPL (>= 3) |
Version: | 2.1.2.9000 |
Built: | 2025-01-25 05:37:07 UTC |
Source: | https://github.com/pydemull/activanalyzer |
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.
average_results(data, minimum_wear_time = 10, fun = c("mean", "median"))
average_results(data, minimum_wear_time = 10, fun = c("mean", "median"))
data |
A dataframe obtained using the |
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. |
A dataframe.
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 ) 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", ) 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 average_results(data = summary_by_day, minimum_wear_time = 10)
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 ) 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", ) 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 average_results(data = summary_by_day, minimum_wear_time = 10)
This function computes metrics that summarise the pattern of accumulation of either sedentary behaviour or physical activity (depending on the configuration of the function) over time:
mean_breaks: mean daily number of transitions from a sedentary bout to a physical activity bout (or from a physical activity bout to a sedentary bout); this actually corresponds to the mean daily total number of sedentary (or physical activity) bouts detected.
alpha: provides information on the relative proportion of
short and long bouts. The higher the alpha coefficient, the more the individual tends to
accumulate sedentary (or physical activity) time using relatively short bouts. Alpha is
computed using all the bouts of the days and periods of the day considered for analysis. Alpha
is computed using the following equation provided by Chastin et al. (2010; doi: 10.1016/j.gaitpost.2009.09.002):
, with
the total number of bouts,
the duration of the bout
, and
the shortest recorded bout duration.
median bout duration (MBD): refers to the median sedentary (or physical activity) bout duration. MBD is computed using all the bouts of the days and periods of the day considered for analysis.
usual bout duration (UBD): refers to the bout duration under/above which 50% of sedentary
(or physical activity) time is accumulated. UBD is computed using all the bouts of the days and periods
of the day considered for analysis. UBD is determined as described in Belletiere al. (2017; doi:10.1371/journal.pone.0180119)
supplementary file 1. More precisely, UBD is found using non-linear regression with the following model: ,
with
the bout duration,
a free parameter, and
the fraction of total time accumulated in bouts
.
Gini index: provides information on the equality with which bout durations
contribute to total sedentary (or physical activity) time. A value of 1 reveals perfect
inequality, and a value of 0 reveals perfect equality. Gini index is computed using all
the bouts of the days and periods of the day considered for analysis. Gini index is computed following
the procedure described at the following link: https://www.statology.org/gini-coefficient-excel/. This method
provides similar results as the frequency method implemented in the Gini
function from the DescTools
R package.
The appearance of the graphics generated by the function has been inspired by the supplementary file provided by Belletiere al. (2017; doi:10.1371/journal.pone.0180119).
compute_accumulation_metrics( data, col_time = "time", col_cat_int = "intensity_category", behaviour = c("sed", "pa"), dates = NULL, valid_wear_time_start = "00:00:00", valid_wear_time_end = "23:59:59", zoom_from = "00:00:00", zoom_to = "23:59:59" )
compute_accumulation_metrics( data, col_time = "time", col_cat_int = "intensity_category", behaviour = c("sed", "pa"), dates = NULL, valid_wear_time_start = "00:00:00", valid_wear_time_end = "23:59:59", zoom_from = "00:00:00", zoom_to = "23:59:59" )
data |
A dataframe obtained using the |
col_time |
A character value to indicate the name of the variable containing time data. |
col_cat_int |
A character value indicating the name of the variable where intensity category (SED, LPA, MVPA) is provided. |
behaviour |
A character value indicating whether metrics should be computed for sedentary behaviour or physical activity. |
dates |
A character vector containing the dates to be retained for analysis. The dates must be with the "YYYY-MM-DD" format. Default is NULL. |
valid_wear_time_start |
A character value with the HH:MM:SS format to set the start of the daily period that will be considered for computing metrics. |
valid_wear_time_end |
A character value with the HH:MM:SS format to set the end of the daily period that will be considered for computing metrics. |
zoom_from |
A character value with the HH:MM:SS format to set the start of the daily period to visualize regarding the daily breaks. |
zoom_to |
A character value with the HH:MM:SS format to set the end of the daily period to visualize regarding the daily breaks. |
A list of numeric and graphic objects related to mean daily total breaks, alpha, MBD, UBD and Gini index. The list also contains
the processed datasets that were used to provide these metrics: recap_bouts_by_day
used to compute mean_break
, recap_bouts
used
to compute alpha
and MBD
, summarised_bouts
used to compute UBD
, and summarised_bouts2
used to compute Gini index
.
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 ) 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", ) compute_accumulation_metrics( data = mydata_with_intensity_marks, behaviour = "sed", dates = c("2021-04-07", "2021-04-08", "2021-04-09", "2021-04-10", "2021-04-11"), valid_wear_time_start = "00:00:00", valid_wear_time_end = "23:59:59", zoom_from = "00:00:00", zoom_to = "23:59:59" )
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 ) 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", ) compute_accumulation_metrics( data = mydata_with_intensity_marks, behaviour = "sed", dates = c("2021-04-07", "2021-04-08", "2021-04-09", "2021-04-10", "2021-04-11"), valid_wear_time_start = "00:00:00", valid_wear_time_end = "23:59:59", zoom_from = "00:00:00", zoom_to = "23:59:59" )
This function computes Basal Metabolic Rate in kcal/d using a Henry et al.
(2005; doi: 10.1079/PHN2005801) equation. This function is wrapped within
the mark_intensity
and recap_by_day
functions.
compute_bmr( age = 40, sex = c("male", "female", "intersex", "undefined", "prefer not to say"), weight = 70 )
compute_bmr( age = 40, sex = c("male", "female", "intersex", "undefined", "prefer not to say"), weight = 70 )
age |
A numeric value in yr. |
sex |
A character value. |
weight |
A numeric value in kg. |
A numeric value.
compute_bmr(age = 32, sex = "male", weight = 67)
compute_bmr(age = 32, sex = "male", weight = 67)
This function computes metrics that describe the distribution of intensity for each day of a dataset. Computations are performed based on the daily periods set for analysis and on the detected wear time.
compute_intensity_distri_metrics( data, col_axis = "vm", col_time = "time", valid_wear_time_start = "00:00:00", valid_wear_time_end = "23:59:59", start_first_bin = 0, start_last_bin = 10000, bin_width = 500 )
compute_intensity_distri_metrics( data, col_axis = "vm", col_time = "time", valid_wear_time_start = "00:00:00", valid_wear_time_end = "23:59:59", start_first_bin = 0, start_last_bin = 10000, bin_width = 500 )
data |
A dataframe obtained using the |
col_axis |
A character value to indicate the name of the variable to be used to compute total time per bin of intensity. |
col_time |
A character value to indicate the name of the variable to be used to determine the epoch length of the dataset. |
valid_wear_time_start |
A character value with the HH:MM:SS format to set the start of the daily period that will be considered for computing metrics. |
valid_wear_time_end |
A character value with the HH:MM:SS format to set the end of the daily period that will be considered for computing metrics. |
start_first_bin |
A numeric value to set the lower bound of the first bin of the intensity band (in counts/epoch duration). |
start_last_bin |
A numeric value to set the lower bound of the last bin of the intensity band (in counts/epoch duration). |
bin_width |
A numeric value to set the width of the bins of the intensity band (in counts/epoch duration). |
A list of objects: metrics
, p_band
, and p_log
. metrics
is a dataframe containing
the intensity gradients and the MX metrics (in counts/epoch duration used) as described in Rowlands et al. (2018; doi:10.1249/MSS.0000000000001561).
The graphic p_band
shows the distribution of time spent in the configured bins of intensity for each day of the dataset.
The graphic p_log
shows, for each day, the relationship between the natural log of time spent in each bin with the natural
log of the middle values of the intensity bins.
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 ) 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" ) compute_intensity_distri_metrics( data = mydata_with_intensity_marks, col_axis = "vm", col_time = "time", valid_wear_time_start = "00:00:00", valid_wear_time_end = "23:59:59", start_first_bin = 0, start_last_bin = 10000, bin_width = 500 )
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 ) 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" ) compute_intensity_distri_metrics( data = mydata_with_intensity_marks, col_axis = "vm", col_time = "time", valid_wear_time_start = "00:00:00", valid_wear_time_end = "23:59:59", start_first_bin = 0, start_last_bin = 10000, bin_width = 500 )
This function computes metabolic equivalent of task (METs) from weight, sex, accelerometer counts, and a published
equation from one of the following scientific articles: Sasaki et al. (2011; doi:10.1016/j.jsams.2011.04.003); Santos-Lozano et al.
(2013; 10.1055/s-0033-1337945); Freedson et al. (1998; doi: 10.1097/00005768-199805000-00021). This function is wrapped
within the mark_intensity
function.
compute_mets( data, equation = c("Sasaki et al. (2011) [Adults]", "Santos-Lozano et al. (2013) [Adults]", "Freedson et al. (1998) [Adults]", "Santos-Lozano et al. (2013) [Older adults]"), weight = 70, sex = c("male", "female", "intersex", "undefined", "prefer not to say") )
compute_mets( data, equation = c("Sasaki et al. (2011) [Adults]", "Santos-Lozano et al. (2013) [Adults]", "Freedson et al. (1998) [Adults]", "Santos-Lozano et al. (2013) [Older adults]"), weight = 70, sex = c("male", "female", "intersex", "undefined", "prefer not to say") )
data |
A dataframe obtained using the |
equation |
A character string to indicate the equation to be used for estimating METs. |
weight |
A numeric value in kg. |
sex |
A character value. |
A numeric vector.
library(magrittr) file <- system.file("extdata", "acc.agd", package = "activAnalyzer") mydata <- prepare_dataset(data = file) mydata_with_wear_marks <- mydata %>% mark_wear_time() %>% dplyr::filter(days == 2 & time >= hms::as_hms("14:00:00") & time <= hms::as_hms("15:00:00")) mets <- compute_mets( data = mydata_with_wear_marks, equation = "Sasaki et al. (2011) [Adults]", weight = 67, sex = "male" ) mets
library(magrittr) file <- system.file("extdata", "acc.agd", package = "activAnalyzer") mydata <- prepare_dataset(data = file) mydata_with_wear_marks <- mydata %>% mark_wear_time() %>% dplyr::filter(days == 2 & time >= hms::as_hms("14:00:00") & time <= hms::as_hms("15:00:00")) mets <- compute_mets( data = mydata_with_wear_marks, equation = "Sasaki et al. (2011) [Adults]", weight = 67, sex = "male" ) mets
An MX metric is the count/epoch value at and above which a given amount of the most active minutes is spent (continuously or discontinuously).
compute_mx(x, n)
compute_mx(x, n)
x |
A vector of counts data. |
n |
An integer setting the number of rows in correspondance with the targetted amount of time. |
A numeric value.
Compute mean step accumulation (per min) from a given number of the best continous or discontinuous minutes
compute_peak_step_acc(x, n)
compute_peak_step_acc(x, n)
x |
A vector of steps data, each value corresponding to a total of steps in a minute. |
n |
An integer value setting the number of minutes to be used to compute the metric. |
A numeric value.
This function computes the PROactive activity score based on the daily median or mean of step count or vector magnitude unit (in counts/min) obtained using an ActiGraph accelerometer.
compute_pro_actigraph_score( x, quest = c("C-PPAC", "D-PPAC"), metric = c("steps", "vmu"), fun = c("median", "mean") )
compute_pro_actigraph_score( x, quest = c("C-PPAC", "D-PPAC"), metric = c("steps", "vmu"), fun = c("median", "mean") )
x |
A numeric value that should be the daily median or the daily mean of step count or vector magnitude unit following a measurement of physical activity; see Gimeno-Santos et al. (2015, online supplement, p.71, doi: 10.1183/09031936.00183014) and Garcia-Aymerich et al. (2021, supplemental material, p.17; doi: 10.1136/thoraxjnl-2020-214554). |
quest |
A character value to indicate for which PROactive questionnaire a score of the amount of physical activity should be computed. |
metric |
A character value to indicate the metric for which the PROactive score should be obtained. |
fun |
A character value to indicate if the metric used in the function is the median or the mean of the results obtained each day of the measurement. |
A numeric value.
compute_pro_actigraph_score(x = 3500, quest = "C-PPAC", metric = "steps", fun = "median") compute_pro_actigraph_score(x = 340, quest = "C-PPAC", metric = "vmu", fun = "mean")
compute_pro_actigraph_score(x = 3500, quest = "C-PPAC", metric = "steps", fun = "median") compute_pro_actigraph_score(x = 340, quest = "C-PPAC", metric = "vmu", fun = "mean")
This function provides a score (from 0 to 4) in relation to the response to a given question from the C-PPAC questionnaire.
compute_pro_score_cppac( x, question = c("q1", "q2", "q3", "q4", "q5", "q6", "q7", "q8", "q9", "q10", "q11", "q12"), language = c("en", "fr") )
compute_pro_score_cppac( x, question = c("q1", "q2", "q3", "q4", "q5", "q6", "q7", "q8", "q9", "q10", "q11", "q12"), language = c("en", "fr") )
x |
A character string that is the exact response to the considered question from the C-PPAC questionnaire. |
question |
A character value to identify the question to be considered when providing the score. |
language |
A character value for setting the language of the considered questionnaire. |
A numeric value.
compute_pro_score_cppac( x = "A lot (about 1 hour every day)", question = "q1", language = "en" )
compute_pro_score_cppac( x = "A lot (about 1 hour every day)", question = "q1", language = "en" )
This function provides a score (from 0 to 4) in relation to the response to a given question from the D-PPAC questionnaire.
compute_pro_score_dppac( x, question = c("q1", "q2", "q3", "q4", "q5", "q6", "q7", "q8", "q9", "q10", "q11", "q12"), language = c("en", "fr") )
compute_pro_score_dppac( x, question = c("q1", "q2", "q3", "q4", "q5", "q6", "q7", "q8", "q9", "q10", "q11", "q12"), language = c("en", "fr") )
x |
A character string that is the exact response to the considered question from the D-PPAC questionnaire. |
question |
A character value to identify the question to be considered when providing the score. |
language |
A character value for setting the language of the considered questionnaire. |
A numeric value.
compute_pro_score_dppac( x = "Un petit peu (jusqu\u2019\u00e0 10 minutes au total)", question = "q1", language = "fr" )
compute_pro_score_dppac( x = "Un petit peu (jusqu\u2019\u00e0 10 minutes au total)", question = "q1", language = "fr" )
The function generates a figure showing mortality hazard ratio in correspondence with daily MVPA minutes. The figure is based on data extracted from Ekelund et al. paper (2019; doi: 10.1136/bmj.l4570).
create_fig_mvpa(score, language = c("en", "fr", "de"))
create_fig_mvpa(score, language = c("en", "fr", "de"))
score |
A numeric value for mean daily MVPA time in minutes. |
language |
A character value for setting the language with which the figure should be created: |
A ggplot object.
create_fig_mvpa(score = 27)
create_fig_mvpa(score = 27)
This function creates radar plots in relation to MX metrics as illustrated in Rowlands et al. (2018; doi:10.1249/MSS.0000000000001561) paper, here for each day of an accelerometer measurement.
create_fig_mx_by_day( data, labels = NULL, mpa_cutpoint = 2690, vpa_cutpoint = 6167 )
create_fig_mx_by_day( data, labels = NULL, mpa_cutpoint = 2690, vpa_cutpoint = 6167 )
data |
A dataframe with physical behavior metrics summarised for each day of the measurement. It should have been obtained using
the |
labels |
A vector of numeric values setting the breaks of the Y axis of the radar plot. Default is a vector of 6 values with a start at 0 and an end at the maximum of all the computed MX metrics. |
mpa_cutpoint |
A numeric value at and above which time is considered as spent in moderate-to-vigorous physical activity (in counts/epoch length used to compute MX metrics). Default value is from Sasaki et al. (2011; doi:10.1016/j.jsams.2011.04.003) relating to vector magnitude in counts/min. |
vpa_cutpoint |
A numeric value at and above which time is considered as spent in vigorous physical activity (in counts/epoch length used to compute MX metrics). Default value is from Sasaki et al. (2011; doi:10.1016/j.jsams.2011.04.003) relating to vector magnitude in counts/min. |
A ggplot object
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 ) 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" ) summary_by_day <- recap_by_day( data = mydata_with_intensity_marks, col_axis = "vm", age = 32, weight = 67, sex = "male", valid_wear_time_start = "07:00:00", valid_wear_time_end = "22:00:00", start_first_bin = 0, start_last_bin = 10000, bin_width = 500 )$df_all_metrics create_fig_mx_by_day( data = summary_by_day, labels = seq(2500, 12500, 2500) )
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 ) 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" ) summary_by_day <- recap_by_day( data = mydata_with_intensity_marks, col_axis = "vm", age = 32, weight = 67, sex = "male", valid_wear_time_start = "07:00:00", valid_wear_time_end = "22:00:00", start_first_bin = 0, start_last_bin = 10000, bin_width = 500 )$df_all_metrics create_fig_mx_by_day( data = summary_by_day, labels = seq(2500, 12500, 2500) )
This function creates a radar plot in relation to MX metrics as illustrated in Rowlands et al. (2018; doi:10.1249/MSS.0000000000001561) paper.
create_fig_mx_summary( data, labels = NULL, mpa_cutpoint = 2690, vpa_cutpoint = 6167 )
create_fig_mx_summary( data, labels = NULL, mpa_cutpoint = 2690, vpa_cutpoint = 6167 )
data |
A dataframe with physical behavior metrics summarised using means or medians of valid days. It should have
been obtained using the |
labels |
A vector of numeric values setting the breaks of the Y axis of the radar plot. Default is a vector of 6 values with a start at 0 and an end at the maximum of all the computed MX metrics. |
mpa_cutpoint |
A numeric value at and above which time is considered as spent in moderate-to-vigorous physical activity (in counts/epoch length used to compute MX metrics). Defaut value is from Sasaki et al. (2011; doi:10.1016/j.jsams.2011.04.003) relating to vector magnitude. |
vpa_cutpoint |
A numeric value at and above which time is considered as spent in vigorous physical activity (in counts/epoch length used to compute MX metrics). Defaut value is from Sasaki et al. (2011; doi:10.1016/j.jsams.2011.04.003) relating to vector magnitude. |
A ggplot object
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 ) 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" ) summary_by_day <- recap_by_day( data = mydata_with_intensity_marks, col_axis = "vm", age = 32, weight = 67, sex = "male", valid_wear_time_start = "07:00:00", valid_wear_time_end = "22:00:00", start_first_bin = 0, start_last_bin = 10000, bin_width = 500 )$df_all_metrics recap <- average_results(data = summary_by_day, minimum_wear_time = 10, fun = "median") create_fig_mx_summary( data = recap, labels = seq(2500, 12500, 2500) )
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 ) 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" ) summary_by_day <- recap_by_day( data = mydata_with_intensity_marks, col_axis = "vm", age = 32, weight = 67, sex = "male", valid_wear_time_start = "07:00:00", valid_wear_time_end = "22:00:00", start_first_bin = 0, start_last_bin = 10000, bin_width = 500 )$df_all_metrics recap <- average_results(data = summary_by_day, minimum_wear_time = 10, fun = "median") create_fig_mx_summary( data = recap, labels = seq(2500, 12500, 2500) )
The function generates a figure showing the daily mean of PAL in correspondence with the FAO (2004; http://www.fao.org/3/y5686e/y5686e07.htm#bm07.3) categories.
create_fig_pal(score, language = c("en", "fr", "de"))
create_fig_pal(score, language = c("en", "fr", "de"))
score |
A numeric value for mean daily PAL. |
language |
A character value for setting the language with which the figure should be created: |
A ggplot object.
create_fig_pal(score = 1.8)
create_fig_pal(score = 1.8)
The function generates a figure showing mortality hazard ratio in correspondence with the daily mean of the MVPA/SED ratio. The figure is based on data extracted from Chastin et al. paper (2021; doi: 10.1123/jpah.2020-0635).
create_fig_ratio_mvpa_sed(score, language = c("en", "fr", "de"))
create_fig_ratio_mvpa_sed(score, language = c("en", "fr", "de"))
score |
A numeric value for mean daily MVPA/SED ratio. |
language |
A character value for setting the language with which the figure should be created: |
A ggplot object.
create_fig_ratio_mvpa_sed(score = 0.06)
create_fig_ratio_mvpa_sed(score = 0.06)
The function generates a figure with several common metrics shown for each day of the physical behavior measurement.
create_fig_res_by_day( data, minimum_wear_time_for_analysis = 10, start_day_analysis = "00:00:00", end_day_analysis = "23:59:00", language = c("en", "fr", "de"), metrics = c("all", "volume", "step_acc", "int_distri"), epoch_label = "60s" )
create_fig_res_by_day( data, minimum_wear_time_for_analysis = 10, start_day_analysis = "00:00:00", end_day_analysis = "23:59:00", language = c("en", "fr", "de"), metrics = c("all", "volume", "step_acc", "int_distri"), epoch_label = "60s" )
data |
A dataframe with results obtained using the |
minimum_wear_time_for_analysis |
A numeric value to indicate the minimum number of hours of wear time that was considered to validate a day. |
start_day_analysis |
A character value to indicate the start of the period that was considered to validate a day based on wear time. |
end_day_analysis |
A character value to indicate the end of the period that was considered to validate a day based on wear time. |
language |
A character value for setting the language with which the figure should be created: |
metrics |
A character value for setting the metrics to be shown in the figure. "volume" refers to "activity volume" metrics, step_acc" refers to "step accumulation" metrics, and "int_distri" refers to intensity distribution metrics. By default, the function provides all computed metrics. |
epoch_label |
A character value to be pasted into the names of the variables to build the figure |
A ggplot object
file <- system.file("extdata", "acc.agd", package = "activAnalyzer") mydata <- prepare_dataset(data = file) mydata_with_wear_marks <- mark_wear_time( dataset = mydata, TS = "TimeStamp", cts = "vm", frame = 90, allowanceFrame = 2, streamFrame = 30 ) 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", ) 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 create_fig_res_by_day(summary_by_day, minimum_wear_time_for_analysis = 10, start_day_analysis = "00:00:00", end_day_analysis = "23:59:00", language = "en")
file <- system.file("extdata", "acc.agd", package = "activAnalyzer") mydata <- prepare_dataset(data = file) mydata_with_wear_marks <- mark_wear_time( dataset = mydata, TS = "TimeStamp", cts = "vm", frame = 90, allowanceFrame = 2, streamFrame = 30 ) 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", ) 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 create_fig_res_by_day(summary_by_day, minimum_wear_time_for_analysis = 10, start_day_analysis = "00:00:00", end_day_analysis = "23:59:00", language = "en")
The function generates a figure showing mortality hazard ratio in correspondence with daily SED hours. The figure is based on data extracted from Ekelund et al. paper (2019; doi: 10.1136/bmj.l4570).
create_fig_sed(score, language = c("en", "fr", "de"))
create_fig_sed(score, language = c("en", "fr", "de"))
score |
A numeric value for mean daily SED time in minutes. |
language |
A character value for setting the language with which the figure should be created: |
A ggplot object.
create_fig_sed(score = 400)
create_fig_sed(score = 400)
The function generates a figure showing the daily mean of the daily step count in correspondence with the Tudor-Locke et al. (2011; doi: 10.1186/1479-5868-8-79) categories.
create_fig_steps(score, language = c("en", "fr", "de"))
create_fig_steps(score, language = c("en", "fr", "de"))
score |
A numeric value for mean daily step count. |
language |
A character value for setting the language with which the figure should be created: |
A ggplot object.
create_fig_steps(score = 12500)
create_fig_steps(score = 12500)
The function generates a formatted table with both means and medians of the metrics obtained following the physical behavior measurement.
create_flextable_summary( results_summary_means, results_summary_medians, language = c("en", "fr"), metrics = c("all", "volume", "step_acc", "int_distri"), epoch_label = "60s" )
create_flextable_summary( results_summary_means, results_summary_medians, language = c("en", "fr"), metrics = c("all", "volume", "step_acc", "int_distri"), epoch_label = "60s" )
results_summary_means |
A dataframe with mean results obtained using the |
results_summary_medians |
A dataframe with median results obtained using the |
language |
A character value for setting the language with which the figure should be created: |
metrics |
A character value for setting the metrics to be shown in the figure. "volume" refers to "activity volume" metrics, step_acc" refers to "step accumulation" metrics, and "int_distri" refers to intensity distribution metrics. By default, the function provides all computed metrics. |
epoch_label |
A character value to be pasted into the names of the variables to build the figure |
A flextable object
file <- system.file("extdata", "acc.agd", package = "activAnalyzer") mydata <- prepare_dataset(data = file) mydata_with_wear_marks <- mark_wear_time( dataset = mydata, TS = "TimeStamp", cts = "vm", frame = 90, allowanceFrame = 2, streamFrame = 30 ) 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", ) 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 results_summary_means <- average_results( data = summary_by_day, minimum_wear_time = 10, fun = "mean" ) results_summary_medians <- average_results( data = summary_by_day, minimum_wear_time = 10, fun = "median" ) create_flextable_summary( results_summary_means, results_summary_medians, language = "en" )
file <- system.file("extdata", "acc.agd", package = "activAnalyzer") mydata <- prepare_dataset(data = file) mydata_with_wear_marks <- mark_wear_time( dataset = mydata, TS = "TimeStamp", cts = "vm", frame = 90, allowanceFrame = 2, streamFrame = 30 ) 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", ) 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 results_summary_means <- average_results( data = summary_by_day, minimum_wear_time = 10, fun = "mean" ) results_summary_medians <- average_results( data = summary_by_day, minimum_wear_time = 10, fun = "median" ) create_flextable_summary( results_summary_means, results_summary_medians, language = "en" )
This function performs all analyses successively using the default data file associated to the package. It is an internal function allowing the computation of the speed of the whole analysis process, from the data importation to the final line of the results.
do_all_analyses(to_epoch = 60)
do_all_analyses(to_epoch = 60)
to_epoch |
A numeric value to set the epoch required to collapse counts in seconds. |
A dataset (1 row) with all computed metrics.
Get WHO physical activity guidelines status
get_guidelines_status(value, language = c("en", "fr"))
get_guidelines_status(value, language = c("en", "fr"))
value |
A numeric value to indicate the daily mean of MET-hours spent at moderate-to-vigorous physical activity intensity. |
language |
A character value for setting the language with which the table should be created: |
A character string.
get_guidelines_status(value = 5)
get_guidelines_status(value = 5)
The values and graphics are respectively computed and created from the daily periods set for analysis and are based on detected wear time.
get_ig_results( data, col_axis = "vm", col_time = "time", valid_wear_time_start = "00:00:00", valid_wear_time_end = "23:59:59", start_first_bin = 0, start_last_bin = 10000, bin_width = 500, cor_factor = 1 )
get_ig_results( data, col_axis = "vm", col_time = "time", valid_wear_time_start = "00:00:00", valid_wear_time_end = "23:59:59", start_first_bin = 0, start_last_bin = 10000, bin_width = 500, cor_factor = 1 )
data |
A dataframe obtained using the |
col_axis |
A character value to indicate the name of the variable to be used to compute total time per bin of intensity. |
col_time |
A character value to indicate the name of the variable to be used to determine the epoch length of the dataset. |
valid_wear_time_start |
A character value with the HH:MM:SS format to set the start of the daily period that will be considered for computing metrics. |
valid_wear_time_end |
A character value with the HH:MM:SS format to set the end of the daily period that will be considered for computing metrics. |
start_first_bin |
A numeric value to set the lower bound of the first bin of the intensity band (in counts/epoch duration). |
start_last_bin |
A numeric value to set the lower bound of the last bin of the intensity band (in counts/epoch duration). |
bin_width |
A numeric value to set the width of the bins of the intensity band (in counts/epoch duration). |
cor_factor |
A numeric value resulting from the ratio between 60s and the epoch length of the analysed dataset. This is used to convert the number of rows into minutes when getting the results. |
A list of objects.
Get relevant missing physical activity information indicated by the user of the app
get_pa_period_info(period)
get_pa_period_info(period)
period |
A character string pointing to the module id from which information have to be caught. |
A dataframe
Get FAO physical activity level (PAL) status (http://www.fao.org/3/y5686e/y5686e07.htm#bm07.3)
get_pal_status(value, language = c("en", "fr", "de"))
get_pal_status(value, language = c("en", "fr", "de"))
value |
A numeric value to indicate the daily mean of PAL. |
language |
A character value for setting the language with which the table should be created: |
A character string.
get_pal_status(value = 1.8)
get_pal_status(value = 1.8)
Get comment about the MVPA/SED ratio
get_ratio_mvpa_sed_comment(value, language = c("en", "fr"))
get_ratio_mvpa_sed_comment(value, language = c("en", "fr"))
value |
A numeric value to indicate the daily mean of MVPA/SED ratio. |
language |
A character value for setting the language with which the table should be created: |
A character string.
get_ratio_mvpa_sed_comment(value = 0.03)
get_ratio_mvpa_sed_comment(value = 0.03)
This function adds several columns to a dataset that contains accelerometer counts data.
These columns concern respectively sedentary time (SED), light physical activity time (LPA),
moderate physical activity time (MPA), vigorous physical activity time (VPA),
metabolic equivalent of task (METs), kilocalories (kcal), and MET-hours when
time is spent in moderate-to-vigorous physical activity. For the SED, LPA, MPA,
and VPA columns, the function provides, for each epoch, the numeric value 1 when
the value of the configured counts variable respectively fulfills the criteria of the
SED, LPA, MPA, and VPA category (e.g., for the SED column, 1 may be provided if VM counts are <150 counts/min);
otherwise 0 is provided.
METs are computed using the compute_mets
function. METs are computed using a published equation from one
of the following scientific articles: Sasaki et al. (2011; doi:10.1016/j.jsams.2011.04.003); Santos-Lozano et al.
(2013; 10.1055/s-0033-1337945); Freedson et al. (1998; doi: 10.1097/00005768-199805000-00021).
Kilocalories are computed as follows. For non-SED epochs, MET values are multiplied by BMR expressed in kcal/min when using the Santos-Lozano et al.
(2013) equations since, in that study, METs were multiples of the measured (not standard) resting metabolic rate. When using the Sasaki et al. (2011)
and Freedson et al. (1998) equations, the MET values are multiplied by weight and 1/60 since, in those studies, METs were multiples of standard resting
metabolic rate (i.e., 3.5 mLO2/min/kg) and a standard MET is approximately equivalent to 1 kcal/kg/h (Butte et al., 2012; doi: 10.1249/MSS.0b013e3182399c0e).
For SED epochs, BMR expressed in kcal/min is directly used. BMR is computed using the compute_bmr
function that uses sex, age, and weight
inputs, and one of the equations retrieved from the paper by Henry et al. (2005; doi: 10.1079/PHN2005801). MET-hours are obtained by multiplying METs by time
related to each epoch (e.g., 1/60e of an hour for 1-min epochs), only when the MET value is >=3. Of note, kilocalories and MET-hours are initially computed
on a 1-min basis, and are then adjusted using a correction factor to correspond to the epoch duration chosen to analyse the accelerometer dataset.
mark_intensity( data, col_axis = c("vm", "axis1"), col_time = "time", col_nonwear = "non_wearing_count", col_wear = "wearing_count", sed_cutpoint = 200, mpa_cutpoint = 2690, vpa_cutpoint = 6167, equation = c("Sasaki et al. (2011) [Adults]", "Santos-Lozano et al. (2013) [Adults]", "Freedson et al. (1998) [Adults]", "Santos-Lozano et al. (2013) [Older adults]"), age = 40, weight = 70, sex = c("male", "female", "intersex", "undefined", "prefer not to say"), dates = NULL )
mark_intensity( data, col_axis = c("vm", "axis1"), col_time = "time", col_nonwear = "non_wearing_count", col_wear = "wearing_count", sed_cutpoint = 200, mpa_cutpoint = 2690, vpa_cutpoint = 6167, equation = c("Sasaki et al. (2011) [Adults]", "Santos-Lozano et al. (2013) [Adults]", "Freedson et al. (1998) [Adults]", "Santos-Lozano et al. (2013) [Older adults]"), age = 40, weight = 70, sex = c("male", "female", "intersex", "undefined", "prefer not to say"), dates = NULL )
data |
A dataframe obtained using the |
col_axis |
A character value to indicate the name of the variable to be used for determining intensity categories. |
col_time |
A character value to indicate the name of the variable related to time data. |
col_nonwear |
A character value to indicate the name of the variable used to count nonwear time. |
col_wear |
A character value to indicate the name of the variable used to count wear time. |
sed_cutpoint |
A numeric value below which time is considered as spent in sedentary behavior (in counts/min). In the case where the epoch of the dataset would be shorter than 60 s, the function will divide the cut-point value so that it corresponds to the epoch length used. |
mpa_cutpoint |
A numeric value at and above which time is considered as spent in moderate physical activity (in counts/min). In the case where the epoch of the dataset would be shorter than 60 s, the function will divide the cut-point value so that it corresponds to the epoch length used. |
vpa_cutpoint |
A numeric value at and above which time is considered as spent in vigorous physical activity (in counts/min). In the case where the epoch of the dataset would be shorter than 60 s, the function will divide the cut-point value so that it corresponds to the epoch length used. |
equation |
A character string to indicate the equation to be used for estimating METs. |
age |
A numeric value in yr. |
weight |
A numeric value in kg. |
sex |
A character value. |
dates |
A character vector containing the dates to be retained for analysis. The dates must be with the "YYYY-MM-DD" format. |
A dataframe.
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 ) 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", ) head(mydata_with_intensity_marks)
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 ) 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", ) head(mydata_with_intensity_marks)
This function wraps the dataCollapser
and the
wearingMarking
functions from the PhysicalActivity
package.
After collapsing data, the function adds time
and
date
columns. Then, the function analyzes the dataset for nonwear time detection. Finally, the function
adds two variables to the dataset: the variable non_wearing_count
that contains the number 1 when the device was not worn (otherwise, 0 is used),
and the variable wearing_count
that contains the number 1 when the device
was worn (otherwise, 0 is used).
mark_wear_time( dataset, TS = "TimeStamp", to_epoch = 60, cts = "vm", frame = 90, allowanceFrame = 2, streamFrame = 30 )
mark_wear_time( dataset, TS = "TimeStamp", to_epoch = 60, cts = "vm", frame = 90, allowanceFrame = 2, streamFrame = 30 )
dataset |
A dataframe obtained using the |
TS |
A character value indicating the name of the variable where date and time information are provided. |
to_epoch |
A numeric value indicating the length of the epoch to use (in seconds) for accumulating data. The value must be superior or equal to the recording epoch that was used for the measurement. |
cts |
A character value indicating the name of the variable used by the nonwear/wear detection algorithm. |
frame |
A numeric value for the length of the time window (in minutes) used to detect nonwear/wear time. |
allowanceFrame |
A numeric value for the length of the time window (in minutes) with nonzero counts allowed within the detected nonwear period. |
streamFrame |
A numeric value for the length of the time window required around the detected activity to validate nonwear time. |
A dataframe.
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 ) head(mydata_with_wear_marks)
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 ) head(mydata_with_wear_marks)
This function plots accelerometer data against time for each day of measurement, with the possibility to specify the metric to visualize.
plot_data( data, metric = "axis1", col_time = "time", col_nonwear = "non_wearing_count", col_wear = "wearing_count", zoom_from = "00:00:00", zoom_to = "23:59:59" )
plot_data( data, metric = "axis1", col_time = "time", col_nonwear = "non_wearing_count", col_wear = "wearing_count", zoom_from = "00:00:00", zoom_to = "23:59:59" )
data |
A dataframe obtained using the |
metric |
A character value to indicate the name of the variable to be plotted against time. |
col_time |
A character value to indicate the name of the variable to plot time data. |
col_nonwear |
A character value to indicate the name of the variable used to count nonwear time. |
col_wear |
A character value to indicate the name of the variable used to count wear time. |
zoom_from |
A character value with the HH:MM:SS format to set the start of the daily period to visualize. |
zoom_to |
A character value with the HH:MM:SS format to set the end of the daily period to visualize. |
A ggplot
object.
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 ) plot_data( data = mydata_with_wear_marks, metric = "vm", col_time = "time", col_nonwear = "non_wearing_count", col_wear = "wearing_count", zoom_from = "02:00:00", zoom_to = "23:58:00" )
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 ) plot_data( data = mydata_with_wear_marks, metric = "vm", col_time = "time", col_nonwear = "non_wearing_count", col_wear = "wearing_count", zoom_from = "02:00:00", zoom_to = "23:58:00" )
This function plots accelerometer data with intensity categories against time for each day of measurement, with the possibility to specify the metric to visualize.
plot_data_with_intensity( data, metric = "axis1", col_time = "time", col_nonwear = "non_wearing_count", col_wear = "wearing_count", valid_wear_time_start = "00:00:00", valid_wear_time_end = "23:59:59", zoom_from = "00:00:00", zoom_to = "23:59:59" )
plot_data_with_intensity( data, metric = "axis1", col_time = "time", col_nonwear = "non_wearing_count", col_wear = "wearing_count", valid_wear_time_start = "00:00:00", valid_wear_time_end = "23:59:59", zoom_from = "00:00:00", zoom_to = "23:59:59" )
data |
A dataframe obtained using the |
metric |
A character value to indicate the name of the variable to be plotted against time. |
col_time |
A character value to indicate the name of the variable to plot time data. |
col_nonwear |
A character value to indicate the name of the variable used to count nonwear time. |
col_wear |
A character value to indicate the name of the variable used to count wear time. |
valid_wear_time_start |
A character value with the HH:MM:SS format to set the start of the daily period that will be considered for computing valid wear time. |
valid_wear_time_end |
A character value with the HH:MM:SS format to set the end of the daily period that will be considered for computing valid wear time. |
zoom_from |
A character value with the HH:MM:SS format to set the start of the daily period to visualize. |
zoom_to |
A character value with the HH:MM:SS format to set the end of the daily period to visualize. |
A ggplot
object.
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 ) 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", ) plot_data_with_intensity( data = mydata_with_intensity_marks, metric = "vm", valid_wear_time_start = "00:00:00", valid_wear_time_end = "23:59:59", zoom_from = "02:00:00", zoom_to = "23:58:00" )
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 ) 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", ) plot_data_with_intensity( data = mydata_with_intensity_marks, metric = "vm", valid_wear_time_start = "00:00:00", valid_wear_time_end = "23:59:59", zoom_from = "02:00:00", zoom_to = "23:58:00" )
This function reads an .agd file and then creates the vector magnitude variable as follows:
.
The .agd file must contain at least the following columns:
axis1
axis2
axis3
steps
prepare_dataset(data)
prepare_dataset(data)
data |
Path to an .agd file that was exported from ActiLife software. |
A dataframe.
file <- system.file("extdata", "acc.agd", package = "activAnalyzer") mydata <- prepare_dataset(data = file) head(mydata)
file <- system.file("extdata", "acc.agd", package = "activAnalyzer") mydata <- prepare_dataset(data = file) head(mydata)
This function provides the 0-100 Rasch scaled score of a given C-PPAC or D-PPAC raw score (based on: Garcia-Aymerich J, et al. Thorax 2021;0:1–11. doi: 10.1136/thoraxjnl-2020-214554).
rasch_transform( x, quest = c("C-PPAC", "D-PPAC"), score = c("difficulty", "quantity") )
rasch_transform( x, quest = c("C-PPAC", "D-PPAC"), score = c("difficulty", "quantity") )
x |
A numeric value that is the difficulty score (between 0 and 40 for C-PPAC or 0 and 20 for D-PPAC) or the quantity score (between 0 and 15 for C-PPAC or 0 and 17 for D-PPAC) obtained using a PROactive questionnaire. |
quest |
A character value to indicate with which PROactive questionnaire the raw score has been obtained. |
score |
A character value. |
A numeric value.
rasch_transform(33, quest = "C-PPAC", score = "difficulty")
rasch_transform(33, quest = "C-PPAC", score = "difficulty")
Read ActiGraph sleep watch data from a database stored in an AGD file. Return a tibble. (Code is from actigraph.sleepr package https://github.com/dipetkov/actigraph.sleepr/. See LICENSE.note file in the app skeleton.)
read_agd(file, tz = "UTC")
read_agd(file, tz = "UTC")
file |
Full path to an agd file to read. |
tz |
Time zone to convert DateTime ticks to POSIX time. |
A tibble
of activity data with at
least two columns: timestamp and axis1 counts. Optional columns
include axis2, axis2, steps, lux and inclinometer indicators
(incline off, standing, sitting and lying). The device settings
are stored as attributes, which include epochlength
.
The AGD file format is described in the ActiLife 6 Manual. chrome-extension://efaidnbmnnnibpcajpcglclefindmkaj/https://6407355.fs1.hubspotusercontent-na1.net/hubfs/6407355/Product%20Manuals/ActiLife%206%20Users%20Manual%20-%20Rev-A-110315.pdf/
file <- system.file("extdata", "acc.agd", package = "activAnalyzer" ) read_agd(file)
file <- system.file("extdata", "acc.agd", package = "activAnalyzer" ) read_agd(file)
Read ActiGraph sleep watch data from an SQLite database stored in an AGD file and return a list with (at least) five tables: data, sleep, filters, settings, awakenings. The tables have the schema described in the ActiLife 6 User manual and the timestamps are converted from Unix time format to human-readable POSIXct representation. Code is from actigraph.sleepr package https://github.com/dipetkov/actigraph.sleepr/. See LICENCE.note file in the app skeleton.
read_agd_raw(file, tz = "UTC")
read_agd_raw(file, tz = "UTC")
file |
Full path to an agd file to read. |
tz |
Time zone to convert DateTime ticks to POSIX time. |
Some ActiGraph devices contain a capacitive sensor to detect monitor removal when worn against the skin. If that data is available, the return list includes a capsense table as well.
A list of five tables: settings, data, filters, sleep, awakenings and, if available, capsense.
ActiLife 6 User's Manual by the ActiGraph Software Department. 04/03/2012.
covertagd
: R package for converting agd files
from ActiGraph into data.frames.
file <- system.file("extdata", "acc.agd", package = "activAnalyzer" ) str(read_agd_raw(file))
file <- system.file("extdata", "acc.agd", package = "activAnalyzer" ) str(read_agd_raw(file))
This function summarizes various accelerometer metrics for each day of the measurement period.
recap_by_day( data, col_axis = "vm", col_time = "time", col_nonwear = "non_wearing_count", col_wear = "wearing_count", valid_wear_time_start = "00:00:00", valid_wear_time_end = "23:59:59", age = 40, weight = 70, sex = c("male", "female", "intersex", "undefined", "prefer not to say"), start_first_bin = 0, start_last_bin = 10000, bin_width = 500 )
recap_by_day( data, col_axis = "vm", col_time = "time", col_nonwear = "non_wearing_count", col_wear = "wearing_count", valid_wear_time_start = "00:00:00", valid_wear_time_end = "23:59:59", age = 40, weight = 70, sex = c("male", "female", "intersex", "undefined", "prefer not to say"), start_first_bin = 0, start_last_bin = 10000, bin_width = 500 )
data |
A dataframe obtained using the |
col_axis |
A character value to indicate the name of the variable to be used to compute total time per bin of intensity and then intensity gradient. |
col_time |
A character value indicating the name of the variable where time information is provided. |
col_nonwear |
A character value to indicate the name of the variable used to count nonwear time. |
col_wear |
A character value to indicate the name of the variable used to count wear time. |
valid_wear_time_start |
A character value with the HH:MM:SS format to set the start of the daily period to consider for computing valid wear time. |
valid_wear_time_end |
A character value with the HH:MM:SS format to set the end of the daily period to consider for computing valid wear time. |
age |
A numeric value in yr. |
weight |
A numeric value in kg. |
sex |
A character value. |
start_first_bin |
A numeric value to set the lower bound of the first bin of the intensity band (in counts/epoch duration). |
start_last_bin |
A numeric value to set the lower bound of the last bin of the intensity band (in counts/epoch duration). |
bin_width |
A numeric value to set the width of the bins of the intensity band (in counts/epoch duration). |
The following metrics are computed from epochs corresponding to valid wear time:
wear_time: total wear time computed using the daily period defined in the function
total_counts_axis1: total counts for the vertical axis
total_counts_vm: total counts for the vector magnitude
axis1_per_min: mean of the counts per minute for the vertical axis
vm_per_min: mean of the counts per minute for the vector magnitude
minutes_SED: total minutes spent in SED behavior
minutes_LPA: total minutes spent in LPA behavior
minutes_MPA: total minutes spent in MPA behavior
minutes_VPA: total minutes spent in VPA behavior
minutes_MVPA: total minutes spent in MVPA behavior
percent_SED: proportion of wear time spent in SED behavior
percent_LPA: proportion of wear time spent in LPA behavior
percent_MPA: proportion of wear time spent in MPA behavior
percent_VPA: proportion of wear time spent in VPA behavior
percent_MVPA: proportion of wear time spent in MVPA behavior
ratio_mvpa_sed: ratio between MVPA and SED times (minutes_MVPA
/ minutes_SED
)
mets_hours_mvpa: total MET-hours spent in MVPA behavior
total_kcal: total kilocalories
PAL: physical activity level
total_steps: total step count
max_steps_60min: best step accumulation per minute averaged over a window of 60 continuous minutes
max_steps_30min: best step accumulation per minute averaged over a window of 30 continuous minutes
max_steps_20min: best step accumulation per minute averaged over a window of 20 continuous minutes
max_steps_5min: best step accumulation per minute averaged over a window of 5 continuous minutes
max_steps_1min: best step accumulation per minute over a window of 1 minute
peak_steps_60min: step accumulation per minute averaged over the best 60 continuous or discontinuous minutes
peak_steps_30min: step accumulation per minute averaged over the best 30 continuous or discontinuous minutes
peak_steps_20min: step accumulation per minute averaged over the best 20 continuous or discontinuous minutes
peak_steps_5min: step accumulation per minute averaged over the best 5 continuous or discontinuous minutes
peak_steps_1min: step accumulation per minute over the best minute (same result as for max_steps_1min
)
ig: intensity gradient
M1/3: the count value (in counts/epoch duration) at and above which the most active 8h were accumulated over the day
M120: the count value (in counts/epoch duration) at and above which the most active 120 minutes were accumulated over the day
M60: the count value (in counts/epoch duration) at and above which the most active 60 minutes were accumulated over the day
M30: the count value (in counts/epoch duration) at and above which the most active 30 minutes were accumulated over the day
M15: the count value (in counts/epoch duration) at and above which the most active 15 minutes were accumulated over the day
M5: the count value (in counts/epoch duration) at and above which the most active 5 minutes were accumulated over the day
PAL is computed by dividing total energy expenditure (TEE) by BMR. TEE is obtained by summing the kilocalories computed for wear time epochs and the kilocalories related to BMR theoretically expended during nonwear time epochs (it is assumed that the periods where the device was not worn corresponded to sleeping periods, during which energy expenditure is near of BMR), and by multiplying this sum by 10/9 to take into account the thermic effect of food. Of course, such calculations may conduct to underestimate TEE and PAL if the device was removed during prolonged periods of physical activity. Moreover, even if the device was correctly worn, the estimate of PAL is very approximate since both BMR and kilocalories are estimated using methods that may not be accurate at the individual level.
The intensity gradient and the MX metrics are obtained using the compute_intensity_distri_metrics
function.
A list of objects: df_all_metrics
, p_band
, and p_log
.
df_all_metrics
is a dataframe containing all the metrics for each day.
p_band
is a figure that shows the distribution of time spent in the configured bins of intensity for each day of the dataset.
p_log
is a figure that shows, for each day, the relationship between the natural log of time spent in each intensity bin with the natural
log of the middle values of the intensity bins.
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 ) 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" ) recap_by_day( data = mydata_with_intensity_marks, col_axis = "vm", age = 32, weight = 67, sex = "male", valid_wear_time_start = "07:00:00", valid_wear_time_end = "22:00:00", start_first_bin = 0, start_last_bin = 10000, bin_width = 500 )
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 ) 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" ) recap_by_day( data = mydata_with_intensity_marks, col_axis = "vm", age = 32, weight = 67, sex = "male", valid_wear_time_start = "07:00:00", valid_wear_time_end = "22:00:00", start_first_bin = 0, start_last_bin = 10000, bin_width = 500 )
Run the Shiny Application
run_app( onStart = NULL, options = list(launch.browser = TRUE), enableBookmarking = NULL, uiPattern = "/", ... )
run_app( onStart = NULL, options = list(launch.browser = TRUE), enableBookmarking = NULL, uiPattern = "/", ... )
onStart |
A function that will be called before the app is actually run.
This is only needed for |
options |
Named options that should be passed to the |
enableBookmarking |
Can be one of |
uiPattern |
A regular expression that will be applied to each |
... |
arguments to pass to golem_opts.
See |
No return value, called for side effects.