Create a formatted table of results
Source:R/create_flextable_summary.R
create_flextable_summary.Rd
The function generates a formatted table with both means and medians of the metrics obtained following the physical behavior measurement.
Arguments
- results_summary_means
A dataframe with mean results obtained using the
prepare_dataset
,mark_wear_time
,mark_intensity
,recap_by_day
, and then theaverage_results
functions.- results_summary_medians
A dataframe with median results obtained using the
prepare_dataset
,mark_wear_time
,mark_intensity
,recap_by_day
, and then theaverage_results
functions.- language
A character value for setting the language with which the figure should be created:
en
for english;fr
for french.- 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
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",
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
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"
)
Metric
Daily mean | median
Number of valid days
5
Wear time (min)
767.8 (12:47:48) | 770.0 (12:50:00)
Axis 1 total counts
513108.6 | 359125.0
VM total counts
970344.6 | 806592.1
Axis 1 mean (counts/min)
686.7 | 498.8
VM mean (counts/min)
1290.6 | 1047.5
SED time (min)
283.0 (04:43:00) | 292.0 (04:52:00)
LPA time (min)
391.8 (06:31:48) | 407.0 (06:47:00)
MPA time (min)
57.8 (00:57:48) | 51.0 (00:51:00)
VPA time (min)
35.2 (00:35:12) | 4.0 (00:04:00)
MVPA time (min)
93.0 (01:33:00) | 77.0 (01:17:00)
SED wear time proportion (%)
36.9 | 40.0
LPA wear time proportion (%)
50.6 | 50.2
MPA wear time proportion (%)
7.6 | 7.1
VPA wear time proportion (%)
4.9 | 0.6
MVPA wear time proportion (%)
12.4 | 10.7
Ratio MVPA / SED
0.33 | 0.27
Total MVPA MET-hr
8.63 | 5.56
Total kcal
1730.04 | 1548.93
PAL
1.99 | 1.78
Total steps
14869 | 14056
Max step acc. 60 min (steps/min)
57.85 | 50.90
Max step acc. 30 min (steps/min)
70.05 | 71.63
Max step acc. 20 min (steps/min)
74.29 | 83.05
Max step acc. 5 min (steps/min)
95.20 | 112.80
Max step acc. 1 min (steps/min)
109.00 | 118.00
Peak step acc. 60 min (steps/min)
74.60 | 70.88
Peak step acc. 30 min (steps/min)
86.60 | 86.73
Peak step acc. 20 min (steps/min)
91.75 | 97.70
Peak step acc. 5 min (steps/min)
105.24 | 117.20
Peak step acc. 1 min (steps/min)
109.00 | 118.00
Intensity gradient
-1.51 | -1.36
M1/3 (counts/60s)
229.9 | 200.9
M120 (counts/60s)
3089.0 | 2064.0
M60 (counts/60s)
4040.2 | 3054.7
M30 (counts/60s)
4978.6 | 4721.2
M15 (counts/60s)
5730.7 | 5763.9
M5 (counts/60s)
6558.7 | 6160.1
# }