Learn R Programming

psychmeta (version 2.6.4)

generate_bib: Generate a list of references included in meta-analyses

Description

This function generates a list of studies contributing to a meta-analysis

Usage

generate_bib(
  ma_obj = NULL,
  bib = NULL,
  title.bib = NULL,
  style = "apa",
  additional_citekeys = NULL,
  file = NULL,
  output_dir = getwd(),
  output_format = c("word", "html", "pdf", "text", "odt", "rmd", "biblatex",
    "citekeys"),
  analyses = "all",
  match = c("all", "any"),
  case_sensitive = TRUE,
  save_build_files = FALSE,
  header = list(),
  ...
)

Value

A list containing a tibble of bibtex reference data. Additionally, a reference list formatted in the requested style and output_format is exported (or printed if file is "console").

Arguments

ma_obj

A psychmeta meta-analysis object with citekeys supplied.

bib

A BibTeX file containing the citekeys for the meta-analyses.

title.bib

The title to give to the bibliography. If NULL, defaults to "Sources Contributing to Meta-Analyses"

style

What style should references be formatted in? Can be a file path or URL for a CSL citation style or the style ID for any style available from the Zotero Style Repository. Defaults to APA style. (Retrieving a style by ID requires an internet connection. If unavailable, references will be rendered in Chicago style.).

additional_citekeys

Additional citekeys to include in the reference list.

file

The filename or filepath for the output file. If NULL, function will output directly to the R console (if output_format is "text", a tibble with basic citation information; if "citekeys", the citekeys for included sources; otherwise, code to generate the bibliography in an RMarkdown document).

output_dir

The filepath for the output file. Defaults to the current working directory.

output_format

The format of the output reference list. Available options are Word (default), HTML, PDF (requires LaTeX to be installed), ODT, or Rmarkdown, plain text, and BibLaTeX. Returning only the item citekeys is also possible. You can also specify the full name of another RMarkdown output_format.

analyses

Which analyses to extract references for? See filter_ma() for details.

match

Match "all" or "any" of the filter criteria? See filter_ma() for details.

case_sensitive

Logical scalar that determines whether character values supplied in analyses should be treated as case sensitive (TRUE, default) or not (FALSE).

save_build_files

Should the BibTeX and RMarkdown files used to generate the bibliography be saved (default: FALSE; always TRUE if file is NULL)?

header

A list of YAML header parameters to pass to rmarkdown::render().

...

Additional arguments to pass to rmarkdown::render().

See Also

Other output functions: metabulate_rmd_helper(), metabulate()

Examples

Run this code
if (FALSE) {
## Run a meta-analysis using ma_r() and include a citekey argument to provide
## citation information for each source contributing to the meta-analyses.
ma_obj <- ma_r(ma_method = "ic", rxyi = rxyi, n = n, rxx = rxxi, ryy = ryyi,
               construct_x = x_name, construct_y = y_name, sample_id = sample_id,
               moderators = moderator, citekey = citekey, data = data_r_meas_multi)

## Next, use generate_bib() to generate the bibliography for the retained studies.
## The bib argument is the BibTeX or BibLaTeX .bib file containing the full
## reference information for each of the citekeys included in the meta-analysis database.
generate_bib(ma_obj, bib = system.file("templates/sample_bibliography.bib", package="psychmeta"),
             file = "sample bibliography", output_dir = tempdir(), output_format = "word")
}

Run the code above in your browser using DataLab