|>
exampleAB overlap() |>
export("my_file.html")
14 Exporting scan results
export(object, …)
The export
function will make it easier to convert the results of your scan
analyses into tables and descriptions you can add to your documents and presentations. Basically, export
takes a scan
object and converts it to an html-table or latex output.
export
has two “engines” implemented to create the output formats. The “kable” engine is build on top of the knitr
and kableextra
packages. The list provided in the kable_options
argument is implemented in the kable
function of knitr
and the list provided to the kable_styling_options
is implemented in the kable_styling
command of the kableExtra
package. export
sets some defaults for these functions but you can play around and overwrite them.
The “gt” engine is a more recent development and build ontop of the gt
package. “gt” allows to export to html, rtf, latex, docx, pdf, and png.
You can change the use of the engine by setting options("scan.export.engine" = "gt")
or options("scan.export.engine" = "kable")
.
export
works best when used within an rmarkdown file and/or within RStudio
. In RStudio
, the html table will be displayed in the Viewer pane. There you can click the export button () to export an html or bitmap file or you can try drag and drop ➡️ copy and paste the table into another application.
Alternatively, you can set the filename
argument to export the table directly from within the export function. The file name extension you provide will define the resulting file format (e.g. filename = "results.html"
).
If you use the “kable engine”, possible extensions and file formats are html, png, and jpg. The newer “gt engine” also allows to export to docx, rtf, pdf, and tex formats. To apply the new eninge, set options("scan.export.engine" = "gt")
.
The examples provided in this book are created with the gt engine.
Most of the tables will have a default caption and footnotes. If you want to change these, use the caption
and footnote
arguments.
14.1 Single case data files
export(object, summary = FALSE, caption = NA, footnote = NA, filename = NA, kable_styling_options = list(), kable_options = list(), cols, round = 2, …)
export(exampleA1B1A2B2_zvt)
Single case data frame with three cases | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Tick | Trick | Track | |||||||||
zvt | d2 | day | part | zvt | d2 | day | part | zvt | d2 | day | part |
47 | 131 | 1 | A1 | 51 | 100 | 1 | A1 | 54 | 89 | 1 | A1 |
58 | 134 | 2 | A1 | 58 | 126 | 2 | A1 | 57 | 116 | 2 | A1 |
76 | 141 | 3 | A1 | 70 | 130 | 3 | A1 | 51 | 114 | 3 | A1 |
63 | 141 | 4 | B1 | 65 | 130 | 4 | B1 | 61 | 131 | 4 | B1 |
71 | 140 | 5 | B1 | 67 | 137 | 5 | B1 | 57 | 132 | 5 | B1 |
59 | 140 | 6 | B1 | 63 | 133 | 6 | B1 | 53 | 130 | 6 | B1 |
64 | 138 | 7 | A2 | 64 | 136 | 7 | A2 | 58 | 128 | 7 | A2 |
69 | 140 | 8 | A2 | 70 | 137 | 8 | A2 | 57 | 131 | 8 | A2 |
72 | 141 | 9 | A2 | 70 | 135 | 9 | A2 | 60 | 130 | 9 | A2 |
77 | 140 | 10 | B2 | 68 | 128 | 10 | B2 | 55 | 129 | 10 | B2 |
76 | 138 | 11 | B2 | 69 | 137 | 11 | B2 | 58 | 118 | 11 | B2 |
73 | 140 | 12 | B2 | 70 | 138 | 12 | B2 | 58 | 131 | 12 | B2 |
14.2 Descriptive stats
export(object, caption = NA, footnote = NA, filename = NA, kable_styling_options = list(), kable_options = list(), flip = FALSE, round = 2, …)
The flip
argument will rotate the table by 90 degrees.
<- describe(GruenkeWilbert2014)
res export(res)
Descriptive statistics | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Case | Design | n | Missing | M | Median | SD | MAD | Min | Max | Trend | |||||||||
A | B | A | B | A | B | A | B | A | B | A | B | A | B | A | B | A | B | ||
Anton | A-B | 4 | 14 | 0 | 0 | 5.00 | 9.14 | 5 | 9 | 0.82 | 0.77 | 0.74 | 1.48 | 4 | 8 | 6 | 10 | -0.40 | 0.03 |
Bob | A-B | 7 | 11 | 0 | 0 | 3.00 | 8.82 | 3 | 9 | 0.82 | 0.87 | 1.48 | 0.00 | 2 | 7 | 4 | 10 | 0.04 | 0.04 |
Paul | A-B | 6 | 12 | 0 | 0 | 3.83 | 8.83 | 4 | 9 | 0.75 | 0.72 | 0.74 | 0.74 | 3 | 8 | 5 | 10 | -0.26 | 0.02 |
Robert | A-B | 8 | 10 | 0 | 0 | 4.12 | 8.90 | 4 | 9 | 0.83 | 0.99 | 1.48 | 1.48 | 3 | 7 | 5 | 10 | -0.06 | -0.14 |
Sam | A-B | 5 | 13 | 0 | 0 | 4.60 | 9.08 | 5 | 9 | 0.55 | 0.86 | 0.00 | 1.48 | 4 | 8 | 5 | 10 | 0.10 | 0.03 |
Tim | A-B | 4 | 14 | 0 | 0 | 3.00 | 9.00 | 3 | 9 | 0.82 | 0.96 | 0.74 | 1.48 | 2 | 7 | 4 | 10 | -0.60 | 0.00 |
Note. n = Number of measurements; Missing = Number of missing values; M = Mean; Median = Median; SD = Standard deviation; MAD = Median average deviation; Min = Minimum; Max = Maximum; Trend = Slope of dependent variable regressed on measurement-time. |
14.3 Standardized mean differences
export(object, caption = NA, footnote = NA, filename = NA, select = c(“Case”, Mean A
= “mA”, Mean B
= “mB”, SD A
= “sdA”, SD B
= “sdB”, SD Cohen
= “sd cohen”, SD Hedges
= “sd hedges”, “Glass’ delta”, “Hedges’ g”, “Hedges’ g correction”, “Hedges’ g durlak correction”, “Cohen’s d”), kable_styling_options = list(), kable_options = list(), round = 2, decimals = 2, flip = FALSE, …)
The flip
argument will rotate the table by 90 degrees.
smd(exampleAB) |> export(flip = TRUE)
Standardizes mean differences. Comparing phase 1 against phase 2 | |||
---|---|---|---|
Statistic | Johanna | Karolina | Anja |
Mean A | 54.60 | 51.80 | 53.60 |
Mean B | 74.13 | 73.47 | 74.07 |
SD A | 2.41 | 6.83 | 3.05 |
SD B | 8.94 | 9.76 | 7.57 |
SD Cohen | 6.55 | 8.43 | 5.77 |
SD Hedges | 7.97 | 9.19 | 6.83 |
Glass' delta | 8.11 | 3.17 | 6.71 |
Hedges' g | 2.45 | 2.36 | 3.00 |
Hedges' g correction | 2.35 | 2.26 | 2.87 |
Hedges' g durlak correction | 2.23 | 2.14 | 2.72 |
Cohen's d | 2.98 | 2.57 | 3.55 |
Note. SD Cohen = unweigted average of the variance of both phases; SD Hedges = weighted average of the variance of both phases with a degrees of freedom correction; Glass’ delta = mean difference divided by the standard deviation of the A-phase; Hedges’ g = mean difference divided by SD Hedges; Hedges’ g (durlak) correction = approaches for correcting Hedges’ g for small sample sizes; Cohens d = mean difference divided by SD Cohen. |
14.4 Trend analysis
export(object, caption = NA, footnote = NA, filename = NA, kable_styling_options = list(), kable_options = list(), round = 2, decimals = 2, …)
$Marie %>%
exampleABCtrend() %>%
export()
Trend analysis | |||
---|---|---|---|
Phase | Intercept | B | Beta |
values ~ mt | |||
Linear.ALL | 55.16 | 0.61 | 0.39 |
Linear.A | 60.62 | −1.92 | −0.70 |
Linear.B | 74.85 | −0.61 | −0.16 |
Linear.C | 68.87 | −0.19 | −0.05 |
values ~ I(mt^2) | |||
Quadratic.ALL | 59.13 | 0.02 | 0.33 |
Quadratic.A | 57.94 | −0.21 | −0.71 |
Quadratic.B | 73.22 | −0.04 | −0.10 |
Quadratic.C | 68.49 | −0.02 | −0.04 |
Note. Measurement-times start at 0 for each phase. |
14.5 Overlap indices
export(object, caption = NA, footnote = NULL, filename = NA, kable_styling_options = list(), kable_options = list(), round = 2, decimals = 2, flip = FALSE, …)
The flip
argument will rotate the table by 90 degrees.
%>%
exampleA1B1A2B2_zvt select_phases(A = c(1,3), B = c(2,4)) %>%
overlap() %>%
export(flip = TRUE)
Overlap indices. Comparing phase 1 against phase 2 | |||
---|---|---|---|
Statistic | Tick | Trick | Track |
PND | 16.67 | 0.00 | 16.67 |
PEM | 66.67 | 50.00 | 50.00 |
PET | 66.67 | 33.33 | 33.33 |
NAP | 68.06 | 51.39 | 58.33 |
NAP-R | 36.11 | 2.78 | 16.67 |
PAND | 66.67 | 50.00 | 66.67 |
IRD | 0.33 | 0.33 | 0.17 |
Tau-U (A + B - trend A) | 0.07 | −0.16 | −0.04 |
Tau-U (A + B - trend A + trend B) | 0.14 | 0.03 | −0.03 |
Base Tau | 0.27 | −0.25 | 0.13 |
Delta M | 5.50 | 3.17 | 0.83 |
Delta Trend | −0.31 | −1.10 | −0.74 |
SMD | 0.52 | 0.40 | 0.26 |
Hedges g | 0.56 | 0.50 | 0.26 |
Note. PND = Percentage Non-Overlapping Data; PEM = Percentage Exceeding the Median; PET = Percentage Exceeding the Trend; NAP = Nonoverlap of all pairs; NAP-R = NAP rescaled; PAND = Percentage all nonoverlapping data; IRD = Improvement rate difference; Tau U (A + B - trend A) = Parker’s Tau-U; Tau U (A + B - trend A + trend B) = Parker’s Tau-U; Base Tau = Baseline corrected Tau; Delta M = Mean difference between phases; Delta Trend = Trend difference between phases; SMD = Standardized Mean Difference; Hedges g = Corrected SMD. |
14.6 Percentage non-overlapping data
export(object, caption = NA, footnote = NA, filename = NA, kable_styling_options = list(), kable_options = list(), select = c(“Case”, “PND”, “Total”, “Exceeds”), round = 2, …)
pnd(Huber2014) |> export()
Percentage Non-Overlapping Data | |||
---|---|---|---|
Case | PND | Total | Exceeds |
Adam | 0.00 | 27 | 0 |
Berta | 0.00 | 19 | 0 |
Christian | 15.15 | 66 | 10 |
David | 65.15 | 66 | 43 |
14.7 Percentage exceeding the trend
export(object, caption = NA, footnote = NA, filename = NA, kable_styling_options = list(), kable_options = list(), round = 1, …)
pet(exampleAB_decreasing) |> export()
Percent Exceeding the trend | |||
---|---|---|---|
Case | PET | Percentage > upper 95 CI | p (binomial test) |
Peter | 15.4 | 0 | .99 |
Tony | 0.0 | 0 | 1.00 |
Bruce | 64.3 | 0 | .21 |
Note. Assumed increasing values in the B-phase; Binomial test alternative hypothesis: true probability > 50%; Single-sided test. |
14.8 Percentage exceeding the median
export(object, caption = NA, footnote = NA, filename = NA, kable_styling_options = list(), kable_options = list(), round = 2, …)
pem(Huber2014) |> export()
Percent Exceeding the Median | ||||
---|---|---|---|---|
Case | PEM | positives | total | binom.p |
Adam | 25.93 | 7 | 27 | 1 |
Berta | 15.79 | 3 | 19 | 1 |
Christian | 98.48 | 65 | 66 | 0 |
David | 96.97 | 64 | 66 | 0 |
14.9 Nonoverlap of all pairs
export(object, caption = NA, footnote = NA, filename = NA, kable_styling_options = list(), kable_options = list(), select = c(“Case”, “NAP”, “NAP Rescaled”, “w”, “p”, “d”, “R²”), round = 2, …)
nap(Huber2014) |> export()
Nonoverlap of all pairs | ||||||
---|---|---|---|---|---|---|
Case | NAP | NAP Rescaled | w | p | d | R² |
Adam | 28.15 | -43.70 | 194.0 | .97 | -0.69 | 0.11 |
Berta | 17.11 | -65.79 | 157.5 | .99 | -1.00 | 0.20 |
Christian | 86.97 | 73.94 | 86.0 | <.001 | 1.70 | 0.42 |
David | 91.74 | 83.48 | 54.5 | <.001 | 2.06 | 0.51 |
14.10 Tau-U
export(object, caption = NA, footnote = NA, filename = NA, select = “auto”, kable_styling_options = list(), kable_options = list(), meta = FALSE, round = 3, decimals = 3, …)
Set the argument meta = TRUE
to get the results of the meta analysis or set meta = FALSE
(the default) to get a table with each case.
tau_u(exampleAB_decreasing) |> export()
Tau-U analyses | |||||
---|---|---|---|---|---|
Model | Tau | CI lower | CI upper | Z | p |
Peter | |||||
A vs. B | −0.978 | −0.991 | −0.944 | −3.530 | <.001 |
Trend A | −0.293 | −0.857 | 0.590 | −0.911 | .36 |
Trend B | −0.104 | −0.619 | 0.474 | −0.490 | .62 |
A vs. B - Trend A | −0.574 | −0.810 | −0.176 | −3.184 | <.01 |
A vs. B + Trend B | −0.546 | −0.796 | −0.136 | −3.228 | <.01 |
A vs. B + Trend B - Trend A | −0.483 | −0.762 | −0.051 | −2.957 | <.01 |
Tony | |||||
A vs. B | −0.979 | −0.992 | −0.947 | −3.630 | <.001 |
Trend A | −0.182 | −0.786 | 0.600 | −0.623 | .53 |
Trend B | −0.092 | −0.633 | 0.509 | −0.413 | .67 |
A vs. B - Trend A | −0.584 | −0.816 | −0.191 | −3.282 | <.01 |
A vs. B + Trend B | −0.575 | −0.811 | −0.177 | −3.367 | <.001 |
A vs. B + Trend B - Trend A | −0.504 | −0.774 | −0.079 | −3.087 | <.01 |
Bruce | |||||
A vs. B | −0.976 | −0.991 | −0.940 | −3.383 | <.001 |
Trend A | 0.067 | −0.788 | 0.833 | 0.188 | .85 |
Trend B | −0.331 | −0.733 | 0.242 | −1.645 | .10 |
A vs. B - Trend A | −0.607 | −0.827 | −0.225 | −3.345 | <.001 |
A vs. B + Trend B | −0.616 | −0.832 | −0.238 | −3.691 | <.001 |
A vs. B + Trend B - Trend A | −0.596 | −0.822 | −0.209 | −3.668 | <.001 |
Note. Method is ’ complete ‘. Analyses based on Kendall’s Tau b . 95 % CIs for tau are reported. |
tau_u(exampleAB_decreasing) |> export(meta = TRUE)
Overall Tau-U | ||||||
---|---|---|---|---|---|---|
Model | Tau U | se | CI lower | CI upper | z | p |
A vs. B | −0.978 | 0.140 | −0.987 | −0.962 | −16.036 | <.001 |
A vs. B - Trend A | −0.588 | 0.140 | −0.740 | −0.381 | −4.822 | <.001 |
A vs. B + Trend B | −0.579 | 0.140 | −0.733 | −0.369 | −4.725 | <.001 |
A vs. B + Trend B - Trend A | −0.530 | 0.140 | −0.698 | −0.305 | −4.210 | <.001 |
Note. Method is ’ complete ‘. Analyses based on Kendall’s Tau b . 95 % CIs for tau are reported. |
14.11 Piecewise linear models
export(object, caption = NA, footnote = NA, filename = NA, kable_styling_options = list(), kable_options = list(), nice = TRUE, …)
<- plm(exampleA1B1A2B2$Pawel)
res export(res)
Piecewise-regression model predicting variable ‘values’ | |||||||
---|---|---|---|---|---|---|---|
Parameter | B | CI(95%) | SE | t | p | delta R² | |
2.5% | 97.5% | ||||||
Intercept | 12.691 | 6.184 | 19.198 | 3.320 | 3.823 | <.01 | |
Trend mt | 0.224 | -0.995 | 1.443 | 0.622 | 0.361 | .72 | 0.001 |
Level phase B1 | 16.285 | 6.308 | 26.261 | 5.090 | 3.199 | <.01 | 0.118 |
Level phase A2 | 1.479 | -18.806 | 21.764 | 10.350 | 0.143 | .88 | 0.000 |
Level phase B2 | 11.455 | -20.492 | 43.401 | 16.299 | 0.703 | .48 | 0.006 |
Slope phase B1 | -1.406 | -3.130 | 0.318 | 0.879 | -1.599 | .12 | 0.029 |
Slope phase A2 | -1.103 | -2.827 | 0.621 | 0.879 | -1.254 | .21 | 0.018 |
Slope phase B2 | -1.085 | -2.809 | 0.639 | 0.879 | -1.234 | .22 | 0.017 |
Note. F(7, 32) = 7.86; p <.001; R² = 0.632; Adjusted R² = 0.552. |
14.12 Hierarchical piecewise regressions
export(object, caption = NA, footnote = NA, filename = NA, kable_styling_options = list(), kable_options = list(), round = 2, nice = TRUE, casewise = FALSE, …)
%>%
exampleAB_50 add_l2(exampleAB_50.l2) %>%
hplm(lr.test = TRUE, random.slopes = TRUE) %>%
export()
Hierarchical Piecewise Linear Regression predicting variable ‘values’ | |||||
---|---|---|---|---|---|
Predictors | B | SE | df | t | p |
Fixed effects | |||||
Intercept | 48.21 | 1.4 | 1328 | 34.5 | <.001 |
Trend mt | 0.62 | 0.11 | 1328 | 5.52 | <.001 |
Level phase B | 13.87 | 0.89 | 1328 | 15.51 | <.001 |
Slope phase B | 0.86 | 0.12 | 1328 | 7.43 | <.001 |
Random effects | |||||
SD | L | df | p | ||
Intercept | 9.35 | 348.85 | 4 | <.001 | |
Trend mt | 0.1 | 0.83 | 4 | .93 | |
Level phase B | 4.54 | 42.82 | 4 | <.001 | |
Slope phase B | 0.13 | 0.76 | 4 | .94 | |
Residual | 4.97 | NA | NA | NA | |
Model | |||||
AIC | 8693.2 | ||||
BIC | 8771.7 | ||||
ICC | 0.29 | L = 339 | p <.001 | ||
Note. Estimation method ML; Slope estimation method: W; first; 50 cases. |
14.13 Power analyses
export(object, caption = NA, footnote = NA, filename = NA, kable_styling_options = list(), kable_options = list(), round = 3, …)
<- design(
design n = 1, phase_design = list(A = 6, B = 9),
rtt = 0.8, level = 1.4, trend = 0.05
)set.seed(124)
power_test(design, n_sim = 10) |> export()
Test power in percent | ||||
---|---|---|---|---|
Method | Power | Alpha Error | Alpha:Beta | Correct |
plm_level | 80 | 10 | 1:2.0 | 85 |
rand | 90 | 30 | 1:0.3 | 80 |
tauU | 100 | 10 | 1:0.0 | 95 |