mxAlgebraFromString {OpenMx} | R Documentation |
Create MxAlgebra object from a string
Description
Create MxAlgebra object from a string
Usage
mxAlgebraFromString(algString, name = NA, dimnames = NA, ...)
Arguments
algString |
the character string to convert into an R expression |
name |
An optional character string indicating the name of the object. |
dimnames |
list. The dimnames attribute for the algebra: a list of length 2 giving the row and column names respectively. An empty list is treated as NULL, and a list of length one as row names. The list can be named, and the list names will be used as names for the dimensions. |
... |
Forwarded verbatim to mxAlgebra |
See Also
Examples
A <- mxMatrix(values = runif(25), nrow = 5, ncol = 5, name = 'A')
B <- mxMatrix(values = runif(25), nrow = 5, ncol = 5, name = 'B')
model <- mxModel(A, B, name = 'model',
mxAlgebraFromString("A * (B + A)", name = 'test'))
model <- mxRun(model)
model[['test']]$result
A$values * (B$values + A$values)
[Package OpenMx version 2.21.11 Index]