umx_is_class | R Documentation |
Checks the class of each column in a dataframe, seeing if they are %in% a list of classes. Returns a vector of TRUE and FALSE, or, if all ==TRUE, a single binary (the default).
umx_is_class(df, classes = NULL, all = TRUE)
df |
A dataframe to check |
classes |
vector of valid classes, e.g. numeric |
all |
Whether to return a single all() Boolean or each column individually. |
Boolean or Boolean vector
umx_is_numeric()
Other Check or test:
umx_check_names()
,
umx_is_endogenous()
,
umx_is_exogenous()
,
umx_is_numeric()
,
umx_is_ordered()
,
umx
umx_is_class(mtcars) # report class list
# Are the variables in mtcars type character?
umx_is_class(mtcars, "character") # FALSE
# They're all numeric data
umx_is_class(mtcars, "numeric") # TRUE
# Show the test-result for each variable in mtcars
umx_is_class(mtcars, "numeric") # TRUE
# Are they _either_ a char OR a num?
umx_is_class(mtcars, c("character", "numeric"))
# Is zygosity a factor (note we don't drop = F to keep as dataframe)
umx_is_class(twinData[,"zygosity", drop=FALSE], classes = "factor")
umx_is_class(mtcars$mpg) # report class of this column (same as class(mpg))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.