set.cobalt.options: Set and Get Options in 'cobalt'

View source: R/set.cobalt.options.R

set.cobalt.optionsR Documentation

Set and Get Options in cobalt

Description

Makes it easier to set cobalt options. set.cobalt.options() is essentially a wrapper for options() but performs several checks, and get.cobalt.options() is essentially a wrapper for getOption().

Usage

set.cobalt.options(..., default = FALSE)

get.cobalt.options(...)

Arguments

...

For set.cobalt.options(), bal.tab() parameters and the values they should take. These should be the name of the parameter in bal.tab() without "cobalt_" preceding them. See examples. If any values are NULL, the corresponding options will be set back to their defaults.

For get.cobalt.options(), one or more strings containing the name of a parameter option to be retrieved. See examples. If empty, all available options and their values will be returned.

default

if TRUE, sets all cobalt options not named in ... to their default values.

Details

When an option is set to NULL, it is set to its default value. The defaults are not displayed but are listed on the help pages where they appear. Most options correspond to display options, which can be accessed here. Some others (e.g., continuous and binary) are described on the bal.tab() help page.

See Also

  • options()

  • display-options for some arguments that can be set via options.

Examples

# Set un to be TRUE to always display unadjusted 
# balance measures and set binary to "std" to 
# produce standardized mean differences for 
# binary variables.

set.cobalt.options(un = TRUE, binary = "std")

# Note: the above is equivalent to:
# options(cobalt_un = TRUE, cobalt_binary = "std")
# but performs some additional checks

get.cobalt.options("un", "binary")

# Note: the above is equivalent to:
# getOption("cobalt_un")
# getOption("cobalt_binary")

# Return all cobalt options to their defaults

set.cobalt.options(default = TRUE)

# View all available options
get.cobalt.options()


cobalt documentation built on Nov. 21, 2023, 1:06 a.m.