Learn R Programming

umx (version 1.2.7)

umxFactor: umxFactor

Description

A convenient version of mxFactor supporting the common case in which the factor levels are those in the variable.

Usage

umxFactor(x = character(), levels = NA, labels = levels, exclude = NA, collapse = FALSE, ordered = TRUE, verbose = FALSE)

Arguments

x
A variable to recode as an mxFactor (see mxFactor)
levels
defaults to NA. UNLIKE mxFactor, if not specified, the existing levels will be used
labels
= levels (see mxFactor)
exclude
= NA (see mxFactor)
collapse
= FALSE (see mxFactor)
ordered
= TRUE By default return an ordered mxFactor
verbose
Whether to tell user about such things as coercing to factor

Value

- mxFactor

References

- https://github.com/tbates/umx, https://tbates.github.io

See Also

Other Data Functions: umxCovData, umxHetCor, umxPadAndPruneForDefVars, umx_as_numeric, umx_cont_2_quantiles, umx_cov2raw, umx_lower2full, umx_make_MR_data, umx_make_bin_cont_pair_data, umx_make_fake_data, umx_merge_CIs, umx_read_lower, umx_reorder, umx_residualize, umx_round, umx_scale_wide_twin_data, umx_scale, umx_swap_a_block, umx

Examples

Run this code
x = umxFactor(letters) # just do it
str(x)
x = umxFactor(letters, verbose = TRUE) # report coercions
x = umxFactor(letters, ordered = FALSE) # non-ordered factor like factor(x), but handles data.frames
# Dataframe example:
x = umx_factor(mtcars[,c("cyl", "am")], ordered = FALSE) 

Run the code above in your browser using DataLab