reporter: Dynamically Generated Analysis Reports for 'rma.uni' Objects

View source: R/reporter.r

reporterR Documentation

Dynamically Generated Analysis Reports for 'rma.uni' Objects

Description

Function to dynamically generate an analysis report 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 to specify the directory for creating the report. If unspecified, tempdir will be used.

filename

optional character string to specify the filename (without file extension) for the report. If unspecified, 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 to specify whether the report should be opened after it has been generated (the default is TRUE). See ‘Note’.

digits

optional integer to specify 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

either a logical which will suppress the drawing of the forest plot when set to FALSE or a character string with arguments to be added to the call to forest for generating the forest plot.

funnel

either a logical which will suppress the drawing of the funnel plot when set to FALSE or a character string with arguments to be added to the call to funnel for generating the funnel plot.

footnotes

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

verbose

logical to specify whether information on the progress of the report generation should be provided (the 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 effect sizes or 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. By default, a forest plot and a funnel plot are also provided (these can be suppressed by setting forest=FALSE and/or funnel=FALSE).

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 and pandoc 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 to install a lightweight LaTeX distribution based on TeX Live.

Once the report is generated, the function opens 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)

Wolfgang Viechtbauer wvb@metafor-project.org https://www.metafor-project.org

References

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

See Also

rma.uni for the function to fit models for which an analysis report can be generated.

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=""))

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

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

## End(Not run)

wviechtb/metafor documentation built on March 11, 2024, 11:45 a.m.