Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

reporter

Dynamically Generated Analysis Reports for 'rma.uni' Objects


Description

The function dynamically generates analysis reports for objects of class "rma.uni".

Usage

reporter(x, ...)

## S3 method for class 'rma.uni'
reporter(x, dir, filename, format="html_document", open=TRUE,
         digits, forest, funnel, footnotes=FALSE, verbose=TRUE, ...)

Arguments

x

an object of class "rma.uni".

dir

optional character string specifying the directory for creating the report (by default, tempdir will be used).

filename

optional character string specifying the filename (without file extension) for the report (by default, the function sets a filename automatically).

format

output format for the report (either html_document, pdf_document, or word_document). Can be abbreviated. See ‘Note’.

open

logical indicating whether the report should be opened after it has been generated (default is TRUE). See ‘Note’.

digits

integer specifying the number of decimal places to which the printed results should be rounded (if unspecified, the default is to take the value from the object).

forest

optional character string with arguments to be added to the call to forest.rma for generating the forest plot.

funnel

optional character string with arguments to be added to the call to funnel.rma for generating the funnel plot.

footnotes

logical indicating whether additional explanatory footnotes should be added to the report (default is FALSE).

verbose

logical indicating whether information on the progress of the report generation should be provided (default is TRUE).

...

other arguments.

Details

The function dynamically generates an analysis report based on the model object. The report includes information about the model that was fitted, the distribution of the observed outcomes, the estimate of the average outcome based on the fitted model, tests and statistics that are informative about potential (residual) heterogeneity in the outcomes, checks for outliers and/or influential studies, and tests for funnel plot asymmetry. A forest plot and a funnel plot are also provided.

Value

The function generates either a html, pdf, or docx file and returns (invisibly) the path to the generated document.

Note

Since the report is created based on an R markdown document that is generated by the function, the rmarkdown package (https://cran.r-project.org/package=rmarkdown) and pandoc (http://pandoc.org) must be installed.

To render the report into a pdf document (i.e., using format="pdf_document") requires a LaTeX installation. If LaTeX is not already installed, you could try using the tinytex package (https://yihui.name/tinytex/) to install a lightweight LaTeX distribution based on TeX Live.

Once the report is generated, the function tries to open the output file (either a .html, .pdf, or .docx file) with an appropriate application (if open=TRUE). This will only work when an appropriate application for the file type is installed and associated with the extension.

If filename is unspecified, the default is to use report, followed by an underscore (i.e., _) and the name of the object passed to the function. Both the R markdown file (with extension .rmd) and the actual report (with extension .html, .pdf, or .docx) are named accordingly. To generate the report, the model object is also saved to a file (with the same filename as above, but with extension .rdata). Also, files references.bib and apa.csl are copied to the same directory (these files are needed to generate the references in APA format).

Since the report is put together based on predefined text blocks, the writing is not very elegant. Also, using personal pronouns (‘I’ or ‘we’) does not make sense for such a report, so a lot of passive voice is used.

The generated report provides an illustration of how the results of the model can be reported, but is not a substitute for a careful examination of the results.

Author(s)

References

Viechtbauer, W. (2010). Conducting meta-analyses in R with the metafor package. Journal of Statistical Software, 36(3), 1–48. https://www.jstatsoft.org/v036/i03.

See Also

Examples

### copy BCG vaccine data into 'dat'
dat <- dat.bcg

### calculate log risk ratios and corresponding sampling variances
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat,
              slab=paste(author, ", ", year, sep=""))

### random-effects model
res <- rma(yi, vi, data=dat)

## Not run: 
### generate pdf report
reporter(res)
## End(Not run)

metafor

Meta-Analysis Package for R

v2.4-0
GPL (>= 2)
Authors
Wolfgang Viechtbauer [aut, cre] (<https://orcid.org/0000-0003-3463-4063>)
Initial release
2020-03-19

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.