umxMatrix: Make a mxMatrix with automatic labels. Also takes name as the...

View source: R/build_run_modify.R

umxMatrixR Documentation

Make a mxMatrix with automatic labels. Also takes name as the first parameter for more readable code.

Description

umxMatrix is a wrapper for mxMatrix which labels cells buy default, and has the name parameter first in order.

Usage

umxMatrix(
  name = NA,
  type = "Full",
  nrow = NA,
  ncol = NA,
  free = FALSE,
  values = NA,
  labels = TRUE,
  lbound = NA,
  ubound = NA,
  byrow = getOption("mxByrow"),
  baseName = NA,
  dimnames = NA,
  condenseSlots = getOption("mxCondenseMatrixSlots"),
  ...,
  joinKey = as.character(NA),
  joinModel = as.character(NA),
  jiggle = NA
)

Arguments

name

The name of the matrix (Default = NA). Note the different order compared to mxMatrix!

type

The type of the matrix (Default = "Full")

nrow

Number of rows in the matrix: Must be set

ncol

Number of columns in the matrix: Must be set

free

Whether cells are free (Default FALSE)

values

The values of the matrix (Default NA)

labels

Either whether to label the matrix (default TRUE), OR a vector of labels to apply.

lbound

Lower bounds on cells (Defaults to NA)

ubound

Upper bounds on cells (Defaults to NA)

byrow

Whether to fill the matrix down columns or across rows first (Default = getOption('mxByrow')

baseName

Set to override the default (which is to use the matrix name as the prefix).

dimnames

NA

condenseSlots

Whether to save memory by NULLing out unused matrix elements, like labels, ubound etc. Default = getOption('mxCondenseMatrixSlots')

...

Additional parameters (!! not currently supported by umxMatrix)

joinKey

See mxMatrix documentation: Defaults to as.character(NA)

joinModel

See mxMatrix documentation: Defaults to as.character(NA)

jiggle

= NA passed to xmuLabel to jiggle start values (default does nothing)

Value

  • mxMatrix()

References

See Also

  • xmu_simplex_corner(), mxMatrix(), xmuLabel(), umxRAM()

Other Core Model Building Functions: umxModify(), umxPath(), umxRAM(), umxSuperModel(), umx

Examples

## Not run: 
# ==================================================================================
# = 1. Showing how name is first parameter, and how cells are labelled by default. =
# ==================================================================================
umxMatrix("test", "Full", 2, 2)$labels
#      [,1]        [,2]
# [1,] "test_r1c1" "test_r1c2"
# [2,] "test_r2c1" "test_r2c2"

# ===========================================================
# = 2. Over-ride default (matrix name) as prefix for labels =
# ===========================================================
umxMatrix("test", "Full", 2, 2, baseName = "bob")$labels # bob_r1c1


# ==========================================
# = 3. User-provided labels are left as-is =
# ==========================================
umxMatrix("foo", "Lower", nrow=2, ncol=2, labels= c(NA, "beta1", NA))
#      [,1]    [,2]
# [1,] NA      NA  
# [2,] "beta1" NA  


## End(Not run)


tbates/umx documentation built on March 16, 2024, 4:26 a.m.