umx (version 1.9.1)

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 = NA, die = TRUE, no_others = FALSE,
  intersection = FALSE, message = "")

Arguments

namesNeeded

list of variable names to find (a dataframe is also allowed)

data

data.frame (or matrix) to search in for names (default = NA)

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

message

Some helpful text to append when dieing.

References

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

See Also

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

Other Building Functions: umx_var

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab