Functions for getting and setting metafor package options.

getmfopt(x, default=NULL)
setmfopt(...)

Arguments

x

The name of an option. If unspecified, all options are returned.

default

value to return if the option name does not exist.

...

one or more option names and the corresponding values to which they should be set.

Details

The metafor package stores some of its options as a list element called "metafor" in the system options (see options). Hence, getmfopt() is the same as getOption("metafor"). One can also set x to the name of an option to return. With setmfopt(), one can set one or more options to their desired values.

Currently, the following options are supported:

check

logical to specify whether a version check should be carried out when loading the package (the default is TRUE). See here for details. Obviously, this option must be set before loading the package (e.g., with options(metafor=list(check=FALSE))).

silent

logical to specify whether a startup message should be issued when loading the package (the default is FALSE). Obviously, this option must be set before loading the package (e.g., with options(metafor=list(silent=TRUE))). Note that messages about required packages that are automatically loaded are not suppressed by this. To fully suppress all startup messages, load the package with suppressPackageStartupMessages.

space

logical to specify whether an empty line should be added before and after the output (the default is TRUE). See here for details.

digits

a named vector to specify how various aspects of the output should be rounded (unset by default). See here for details.

style

a list whose elements specify the styles for various parts of the output when the crayon package is loaded and a terminal is used that supports ‘ANSI’ color/highlight codes (unset by default). See here for details. Can also be a logical and set to FALSE to switch off output styling when the crayon package is loaded.

theme

character string to specify how plots created by the package should be themed. The default is "default", which means that the default foreground and background colors of plotting devices are used. Alternative options are "light" and "dark", which forces plots to be drawn with a light or dark background, respectively. See here for further details. RStudio users can also set this to "auto", in which case plotting colors are chosen depending on the RStudio theme used (for some themes, using "auto2" might be visually more appealing). One can also use setmfopt(theme="custom", fg=<color>, bg=<color>) to set the foreground and background colors to custom choices (depending on the colors chosen, using "custom2" might be visually more appealing).

Value

Either a vector with the value for the chosen option or a list with all options.

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

Examples

getmfopt()
#> $check
#> [1] TRUE
#> 
#> $silent
#> [1] FALSE
#> 
#> $space
#> [1] TRUE
#> 
#> $theme
#> [1] "default"
#> 
getmfopt(space)
#> [1] TRUE
setmfopt(space=FALSE)
getmfopt()
#> $check
#> [1] TRUE
#> 
#> $silent
#> [1] FALSE
#> 
#> $space
#> [1] FALSE
#> 
#> $theme
#> [1] "default"
#> 
setmfopt(space=TRUE)
getmfopt()
#> $check
#> [1] TRUE
#> 
#> $silent
#> [1] FALSE
#> 
#> $space
#> [1] TRUE
#> 
#> $theme
#> [1] "default"
#>