# NOT RUN {
## Create a results table for meta-analysis of correlations and output to Word:
ma_r_obj <- ma_r(ma_method = "ic", rxyi = rxyi, n = n, rxx = rxxi, ryy = ryyi,
construct_x = x_name, construct_y = y_name,
moderators = moderator, data = data_r_meas_multi)
metabulate(ma_obj = ma_r_obj, file = "meta tables correlations",
output_format = "word", output_dir = tempdir())
## Output to PDF:
metabulate(ma_obj = ma_r_obj, file = "meta tables correlations",
output_format = "pdf", output_dir = tempdir())
## Output to ODT (LibreOffice):
metabulate(ma_obj = ma_r_obj, file = "meta tables correlations",
output_format = "odt", output_dir = tempdir())
## To produce Markdown tables to include inline in an RMarkdown report,
## leave file == NULL and output_format to anything but "text":
ma_table <- metabulate(ma_obj = ma_r_obj, file = NULL, output_format = "rmd")
## Use the metabulate_rmd_helper() function to ensure all symbols render properly.
Insert the following code as 'as-is' output:
metabulate_rmd_helper()
## Then, add the formatted table to your document using your preferred table
## formatting functions:
#### Using just the 'knitr' package, include the following as 'as-is' output:
knitr::kable(ma_table[[1]], caption = attr(ma_table[[1]], "caption"))
cat("\n", attr(ma_table[[1]], "footnote"))
#### Using 'knitr' plus the 'kableExtra' package:
knitr::kable(ma_table[[1]], "latex", booktabs = TRUE,
caption = attr(ma_table[[1]], "caption")) %>%
kableExtra::kable_styling(latex_options = c("striped", "hold_position")) %>%
kableExtra::footnote(general = attr(ma_table[[1]], "footnote")
# !!! Note: On Windows, R currently can only handle Unicode characters if kables
# are printed at top-level (e.g., not in an if() statement, in a for() loop,
# or in lapply() or map() ). To correctly print Unicode metabulate tables, call
# kable() as a top-level function (as above).
## Create output table for meta-analysis of d values:
ma_d_obj <- ma_d(ma_method = "ic", d = d, n1 = n1, n2 = n2, ryy = ryyi,
construct_y = construct, data = data_d_meas_multi)
ma_d_obj <- ma_d_ad(ma_obj = ma_d_obj, correct_rr_g = FALSE, correct_rr_y = FALSE)
metabulate(ma_obj = ma_d_obj, file = "meta tables d values", output_dir = tempdir())
## Create output table for meta-analysis of generic effect sizes:
dat <- data.frame(es = data_r_meas_multi$rxyi,
n = data_r_meas_multi$n,
var_e = (1 - data_r_meas_multi$rxyi^2)^2 / (data_r_meas_multi$n - 1))
ma_obj <- ma_generic(es = es, n = n, var_e = var_e, data = dat)
metabulate(ma_obj = ma_obj, file = "meta tables generic es", output_dir = tempdir())
# }
Run the code above in your browser using DataLab