expression-parts | R Documentation |
List the variables, parameters, constants, or atoms in a canonical expression.
variables(object)
parameters(object)
constants(object)
atoms(object)
object |
A Leaf object. |
A list of Variable, Parameter, Constant, or Atom objects.
set.seed(67)
m <- 50
n <- 10
beta <- Variable(n)
y <- matrix(rnorm(m), nrow = m)
X <- matrix(rnorm(m*n), nrow = m, ncol = n)
lambda <- Parameter()
expr <- sum_squares(y - X %*% beta) + lambda*p_norm(beta, 1)
variables(expr)
parameters(expr)
constants(expr)
lapply(constants(expr), function(c) { value(c) })
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.