[,LinearVariableCollection,ANY,ANY,missing-method {ompr} | R Documentation |
This creates a new variable collection as a subset of the previously defined indexed variable. A variable collection essentially is a data frame having values for rows and columns of the final model matrix.
## S4 method for signature 'LinearVariableCollection,ANY,ANY,missing' x[i, j, ..., drop = TRUE]
x |
an object of type 'LinearVariableCollection' |
i |
a numeric vector or a colwise vector/list |
j |
a numeric vector or a colwise vector/list |
... |
more a numeric vectors or a colwise vector/list |
drop |
do not use this parameter |
a new object of type 'LinearVariableCollection'
## Not run: # vectors create matrix rows # x[1, 1] # x[2, 1] # x[3, 1] x[1:3, 1] # colwise() creates columns per row # 1 * x[1, 1] + 2 * x[1, 2] + 3 * x[1, 3] colwise(1, 2, 3) * x[1, colwise(1, 2, 3)] # you can also combine the two # x[1, 1] # x[2, 1] + x[2, 2] # x[3, 1] + x[3, 2] + x[3, 2] x[1:3, colwise(1, 1:2, 1:3)] ## End(Not run)