| agd_worker | R Documentation |
agd_workeragd_worker is an R6 class that runs a data processing
pipeline on two .agd (ActiGraph; github.com/actigraph) accelerometer files
with LowFrequencyExtension and Normal filters for a single participant.
This class does all the heavy lifting for the agd R6 class.
argsA list of arguments passed into agd_worker$new(). See
documentation for agd_worker$new() for details.
dataA list of four tibbles created during agd_worker$load()
(settings, raw), agd_worker$clean() (clean) and
agd_worker$classify() (classify) representing .agd data at various
stages of the pipeline.
issuesA list of seven length-one, dichotomous ("yes"/"")
character vectors (file_missing, files_identical, files_mismatched,
non_midnight_start, no_complete_days, sleep_missing,
age_out_of_range) representing flags for issues affecting pipeline
results.
logA tibble with method, timestamp, status and message
vectors providing a record of events during the pipeline run.
resultsA list of four tibbles (summary_full,
summary_full_stc, summary_sleeping_hours, summary_waking_hours)
summarizing the pipeline run.
agd_worker$new()This method creates an instance of an agd_worker class.
agd_worker$new( id, age, agd_lfe, agd_nml, epoch_length = 60, day_max = 7, sleep_algo = "barreira", non_wear_algo = "barreira", start_date = NA )
idRequired: a length-one vector representing a unique participant ID.
ageRequired: a length-one integer vector representing a participant's age in years.
agd_lfeRequired: a length-one character vector representing the
full path to an .agd file with the LowFrequencyExtension filter.
agd_nmlRequired: a length-one character vector representing the
full path to an .agd file with the Normal filter.
epoch_lengthRequired (default: 60): a length-one integer
vector representing the epoch length at which to process the data.
Statistics Canada currently uses 15 for participants under 18 years
and 60 for participants at all other ages. Note: if sleep_algo is
set to "barreira" and epoch_length is set to 15, the sleep
algorithm will be applied to 60-second epoch data and the results will
be applied to the 15-second epoch data.
day_maxRequired (default: 7): a length-one integer vector
representing the maximum number of days of data to load from agd_lfe
and agd_nml.
sleep_algoRequired (default: "barreira"): a length-one
character vector representing the sleep algorithm to apply. Options
currently include "barreira". See apply_barreira_algo() for more
details.
non_wear_algoRequired (default: "barreira"): a length-one
character vector representing the non-wear algorithm to apply. Options
currently include "barreira", "20-min-algo", "60-min-algo",
"90-min-algo" and "choi". See apply_barreira_algo() and
apply_non_wear_algo() for more details.
start_dateOptional (default: NA): a length-one date vector
(format: yyyy-mm-dd) representing the first day of data to load from
agd_lfe and agd_nml. If not set, data will be loaded from the first
available day until day_max is reached.
Returns an object of class agd_worker.
agd_worker$load()This method calls load_agd_settings() and
load_agd_data().
agd_worker$load()
Returns the agd_worker object (self) invisibly.
agd_worker$clean()This method calls clean_agd_data().
agd_worker$clean()
Returns the agd_worker object (self) invisibly.
agd_worker$classify()This method calls classify_agd_data().
agd_worker$classify()
Returns the agd_worker object (self) invisibly.
agd_worker$summarize()This method calls summarize_agd_data().
agd_worker$summarize()
Returns the agd_worker object (self) invisibly.
agd_worker$run()This method calls agd_worker$load(),
agd_worker$clean(), agd_worker$classify() and
agd_worker$summarize().
agd_worker$run()
Returns the agd_worker object (self) invisibly.
agd_worker$print()This method renders details (arguments, issues, log) about
an instance of agd_worker to the console.
agd_worker$print()
Returns the agd_worker object (self) invisibly.
agd_worker$clone()The objects of this class are cloneable with this method.
agd_worker$clone(deep = FALSE)
deepWhether to make a deep clone.
# 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"
)
# Run data processing pipeline (load, clean, classify and summarize data)
agd_data$run()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.