Learn R Programming

umx (version 1.9.1)

umx_var: Get variances from a df that might contain some non-numeric columns

Description

Pass in any dataframe and get variances despite some non-numeric columns. Cells involving these non-numeric columns are set to ordVar (default = 1).

Usage

umx_var(df, ordVar = 1, format = c("full", "diag", "lower"),
  use = c("complete.obs", "pairwise.complete.obs", "everything", "all.obs",
  "na.or.complete"))

Arguments

df

a dataframe of raw data from which to get variances.

ordVar

The value to return at any ordinal columns (defaults to 1).

format

to return: options are c("full", "diag", "lower"). Defaults to full, but this is not implemented yet.

use

passed to cov - defaults to "complete.obs" (see param default for other options).

Value

- mxModel

References

- http://tbates.github.io

See Also

Other Building Functions: umx_check_names

Examples

Run this code
# NOT RUN {
tmp     = mtcars[,1:4]
tmp$cyl = ordered(mtcars$cyl) # ordered factor
tmp$hp  = ordered(mtcars$hp)  # binary factor
umx_var(tmp, format = "diag", ordVar = 1, use = "pair")
tmp2 = tmp[, c(1,3)]
umx_var(tmp2, format = "diag")
umx_var(tmp2, format = "full")
# }

Run the code above in your browser using DataLab