Learn R Programming

umx (version 1.4.0)

umx_default_option: umx_default_option

Description

Handle parameter options given as a default list in a function. This is just a version of x = match.arg(x) which allows items not in the list.

Usage

umx_default_option(x, option_list, check = TRUE)

Arguments

x
the value chosen (may be the default option list)
option_list
A vector of valid options
check
Whether to check that single items are in the list. Set false to accept abbreviations (defaults to TRUE)

Value

- one validated option

References

- http://www.github.com/tbates/umx

See Also

- match.arg

Other Misc: umxEval, umx_APA_model_CI, umx_add_variances, umx_apply, umx_get_bracket_addresses, umx_object_as_str, umx_string_to_algebra, umx

Examples

Run this code
## Not run: 
# option_list = c("default", "par.observed", "empirical")
# umx_default_option("par.observed", option_list)
# umx_default_option("bad", option_list)
# umx_default_option("allow me", option_list, check = FALSE)
# umx_default_option(option_list, option_list)
# option_list = c(NULL, "par.observed", "empirical")
# umx_default_option(option_list, option_list) # fails with NULL!!!!!
# option_list = c(NA, "par.observed", "empirical")
# umx_default_option(option_list, option_list) # use NA instead
# option_list = c(TRUE, FALSE, NA)
# umx_default_option(option_list, option_list) # works with non character
# ## End(Not run)

Run the code above in your browser using DataLab