metabulate {psychmeta} | R Documentation |
Write a summary table of meta-analytic results
Description
Write a summary table of meta-analytic results
Usage
metabulate(
ma_obj,
file = NULL,
output_dir = getwd(),
output_format = c("word", "html", "pdf", "odt", "text", "rmd"),
show_msd = TRUE,
show_conf = TRUE,
show_cred = TRUE,
show_se = FALSE,
show_var = FALSE,
analyses = "all",
match = c("all", "any"),
case_sensitive = TRUE,
ma_method = "ad",
correction_type = "ts",
collapse_construct_labels = TRUE,
bold_headers = TRUE,
digits = 2L,
decimal.mark = getOption("OutDec"),
leading0 = "conditional",
drop0integer = FALSE,
neg.sign = "−",
pos.sign = "figure_html",
big.mark = " ",
big.interval = 3L,
small.mark = " ",
small.interval = 3L,
na.mark = "—",
lgl.mark = c("+", "−"),
inf.mark = c("+∞", "−∞"),
conf_format = "brackets",
cred_format = "brackets",
symbol_es = "ES",
caption = "Results of meta-analyses",
header = NULL,
verbose = FALSE,
unicode = NULL,
bib = NULL,
title.bib = NULL,
style = "apa",
additional_citekeys = NULL,
save_build_files = FALSE,
...
)
Arguments
ma_obj |
A psychmeta meta-analysis object. |
file |
The filename (optionally with a subfolder path) for the output file. If |
output_dir |
The filepath for the output directory/folder. Defaults to the current working directory. |
output_format |
The format of the output tables. Available options are Word (default), HTML, PDF (requires LaTeX and the |
show_msd |
Logical. Should means and standard deviations of effect sizes be shown (default |
show_conf |
Logical. Should confidence intervals be shown (default: |
show_cred |
Logical. Should credibility intervals be shown (default: |
show_se |
Logical Should standard errors be shown (default: |
show_var |
Logical. Should variances be shown (default: |
analyses |
Which analyses to extract references for? See |
match |
Match |
case_sensitive |
Logical scalar that determines whether character values supplied in |
ma_method |
Meta-analytic methods to be included. Valid options are: |
correction_type |
Type of meta-analytic corrections to be included. Valid options are: "ts" (default), "vgx", and "vgy". Multiple options are permitted. |
collapse_construct_labels |
Should the construct labels for construct pairs with multiple rows of results be simplified so that only the first occurrence of each set of construct names is shown ( |
bold_headers |
Logical. Should column headers be bolded (default: |
digits , decimal.mark , leading0 , drop0integer , neg.sign , pos.sign , big.mark , big.interval , small.mark , small.interval , na.mark , lgl.mark , inf.mark |
Number formatting arguments. See |
conf_format |
How should confidence intervals be formatted? Options are:
|
cred_format |
How should credibility intervals be formatted? Options are the same as for |
symbol_es |
For meta-analyses of generic (non-r, non-d) effect sizes, the symbol used for the effect sizes (default: |
caption |
Caption to print before tables. Either a character scalar or a named character vector with names corresponding to combinations of |
header |
A list of YAML header parameters to pass to |
verbose |
Logical. Should detailed SD and variance components be shown (default: |
unicode |
Logical. If |
bib |
A BibTeX file containing the citekeys for the meta-analyses. If provided and file is not |
title.bib |
The title to give to the bibliography (see |
style |
What style should the bibliography (see |
additional_citekeys |
Additional citekeys to include in the reference list (see |
save_build_files |
Should the RMarkdown and BibLaTeX (if any) files used to generate the output be saved (default: |
... |
Additional arguments to pass to |
Value
A list of meta-analysis results tibble
s with "caption" and "footnote" attributes.
If file
is specified, formatted tables and bibliographies are exported in the requested output_format
.
Formatted tables of meta-analytic output.
See Also
Other output functions:
generate_bib()
,
metabulate_rmd_helper()
Examples
## 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())
## End(Not run)