For example, if I run the following lines in R terminal under Ubuntu:
library(quadprog)
Dmat <- matrix(0,3,3)
diag(Dmat) <- 1
dvec <- c(0,5,0)
Amat <- matrix(c(-4,-3,0,2,1,0,0,-2,1),3,3)
bvec <- c(-8,2,0)
solve.QP(Dmat,dvec,Amat,bvec=bvec)
I will see these output:
$solution
[1] 0.4761905 1.0476190 2.0952381
$value
[1] -2.380952
$unconstrained.solution
[1] 0 5 0
$iterations
[1] 3 0
$Lagrangian
[1] 0.0000000 0.2380952 2.0952381
$iact
[1] 3 2
How to access these return values, like $solution inside the terminal? This question assumes not storing solve.QP()'s output to variable.