Learn R Programming

umx (version 1.4.0)

umx_check_names: umx_check_names

Description

Check if a list of names are in the names() of a dataframe (or the of a matrix)

Usage

umx_check_names(namesNeeded, data, die = TRUE, no_others = FALSE, intersection = FALSE)

Arguments

namesNeeded
list of variable names to find (a dataframe is also allowed)
data
data.frame (or matrix) to search in for names
die
whether to die if the check fails (defaults to TRUE)
no_others
Whether to test that the data contain no columns in addition to those in namesNeeded (defaults to FALSE)
intersection
Show the intersection of names

References

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

See Also

Other Building Functions: umx_cov_diag

Other Test: umx_check_OS, umx_check_model, umx_check_parallel, umx_check, umx_has_CIs, umx_has_been_run, umx_has_means, umx_has_square_brackets, umx_is_MxData, umx_is_MxMatrix, umx_is_MxModel, umx_is_RAM, umx_is_cov, umx_is_endogenous, umx_is_exogenous, umx_is_ordered

Examples

Run this code
require(umx)
data(demoOneFactor) # "x1" "x2" "x3" "x4" "x5"
umx_check_names(c("x1", "x2"), demoOneFactor)
umx_check_names(c("x1", "x2"), as.matrix(demoOneFactor))
umx_check_names(c("x1", "x2"), cov(demoOneFactor[,c("x1","x2")]))
umx_check_names(c("z1", "x2"), data = demoOneFactor, die = FALSE)
umx_check_names(c("x1", "x2"), data = demoOneFactor, die = FALSE, no_others = TRUE)
umx_check_names(c("x1","x2","x3","x4","x5"), data = demoOneFactor, die = FALSE, no_others = TRUE)
## Not run: 
# umx_check_names(c("bad_var_name", "x2"), data = demoOneFactor, die = TRUE)
# ## End(Not run)

Run the code above in your browser using DataLab