mxAlgebraFromString | R Documentation |
Create MxAlgebra object from a string
mxAlgebraFromString(algString, name = NA, dimnames = NA, ...)
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 |
mxAlgebra
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.