The activAnalyzer package was primarily built for working through a Shiny app. The procedure for using the app is explained in the related user’s guide. The functions used in this app can also be used to analyze data outside the app, as shown below.
plot_data(
data = mydata_with_wear_marks,
metric = "vm",
zoom_from = "16:00:00",
zoom_to = "18:00:00"
)
plot_data_with_intensity(
mydata_with_intensity_marks,
metric = "vm",
valid_wear_time_start = "00:00:00",
valid_wear_time_end = "23:59:59"
)
plot_data_with_intensity(
mydata_with_intensity_marks,
metric = "vm",
valid_wear_time_start = "07:00:00",
valid_wear_time_end = "22:00:00"
)
plot_data_with_intensity(
mydata_with_intensity_marks,
metric = "vm",
zoom_from = "13:00:00",
zoom_to = "16:30:00"
)
create_fig_res_by_day(
results_by_day$df_all_metrics,
minimum_wear_time_for_analysis = 10,
start_day_analysis = "00:00:00",
end_day_analysis = "23:59:00",
metrics = "volume",
epoch_label = "60s"
) + theme(plot.margin = margin(1, 1, 1, 1, "cm"))
create_flextable_summary(
results_summary_means = mean_results,
results_summary_medians = median_results,
metrics = "volume",
epoch_label = "60s"
)
# PAL
g_pal <- create_fig_pal(score = mean_results[["pal"]], "en") + theme(plot.margin = margin(2, 1, 0.5, 1, "cm"))
# Steps
g_steps <- create_fig_steps(score = mean_results[["total_steps"]], "en") + theme(plot.margin = margin(0, 1, 0.5, 1, "cm"))
# MVPA
g_mvpa <- create_fig_mvpa(score = mean_results[["minutes_MVPA"]], "en") + theme(plot.margin = margin(0, 1, 0, 1, "cm"))
# SED
g_sed <- create_fig_sed(score = mean_results[["minutes_SED"]], "en") + theme(plot.margin = margin(0, 1, 0, 1, "cm"))
# MVPA/SED ratio
g_ratio <- create_fig_ratio_mvpa_sed(score = mean_results[["ratio_mvpa_sed"]], "en") + theme(plot.margin = margin(0, 1, 1, 1, "cm"))
# Whole figure
(g_pal + theme(legend.position = "top")) / g_steps / (g_mvpa | g_sed | g_ratio) +
plot_layout(heights = c(0.8, 0.7, 1.5)) & theme(legend.justification = "center")
create_fig_res_by_day(
results_by_day$df_all_metrics,
minimum_wear_time_for_analysis = 10,
start_day_analysis = "00:00:00",
end_day_analysis = "23:59:00",
metrics = "int_distri",
epoch_label = "60s"
) + theme(plot.margin = margin(1, 1, 1, 1, "cm"))
p1 <- accum_metrics_sed$p_alpha + guides(color = "none", fill = "none")
p2 <- accum_metrics_sed$p_MBD + guides(color = "none", fill = "none")
p3 <- accum_metrics_sed$p_UBD
p4 <- accum_metrics_sed$p_gini
(p1 | p2) / (p3 | p4) + plot_layout(guides = "collect") & theme(legend.position = 'bottom')
p1 <- accum_metrics_pa$p_alpha + guides(color = "none", fill = "none")
p2 <- accum_metrics_pa$p_MBD + guides(color = "none", fill = "none")
p3 <- accum_metrics_pa$p_UBD
p4 <- accum_metrics_pa$p_gini
(p1 | p2) / (p3 | p4) + plot_layout(guides = "collect") & theme(legend.position = 'bottom')