Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

expression-parts

Parts of an Expression Leaf


Description

List the variables, parameters, constants, or atoms in a canonical expression.

Usage

variables(object)

parameters(object)

constants(object)

atoms(object)

Arguments

object

A Leaf object.

Value

A list of Variable, Parameter, Constant, or Atom objects.

Examples

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) })

CVXR

Disciplined Convex Optimization

v1.0-10
Apache License 2.0 | file LICENSE
Authors
Anqi Fu [aut, cre], Balasubramanian Narasimhan [aut], David W Kang [aut], Steven Diamond [aut], John Miller [aut], Stephen Boyd [ctb], Paul Kunsberg Rosenfield [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.