It will multiply the numeric vector with both the constant and the variable in 'LinearVariableSum'
It will multiply the numeric vector with both the constant and the variable in 'LinearVariableSum'
Equivalent to `e1 + -1 * e2`
Equivalent to `(-1 * e2) - (-1 * e1)`
Add two object of 'LinearVariableSum'. I.e. variables + constants
Equivalent to `e1 + (-1) * e2`
Adds the variables in the rhs to the variables in the lhs and returns another 'LinearVariableSum'.
Equivalent to `e2 + e1`
Equivalent to `-1 * (e2 - e1)`
Equivalent to `e1 + -1 * e2`
Adds a constant (rhs) to constant slot of the lhs object.
Equivalent to `e2 + e1`
Equivalent to `e1 * (-1)`
Equivalent to `e1 * (-1)`
Equivalent to `e1`
Equivalent to `e1`
Adds a constant numeric vector to a variable. The constant needs to be a vector of length 1.
Equivalent to `e2 + e1`
Equivalent to `e1 + -1 * e2`
Equivalent to `(-1 * e2) - (-1 * e1)`
Equivalent to `e1 * (1 / e2)`
Equivalent to `e1 * (1 / e2)`
Adds two variables together. Same values for variable, row and col will be added. Everything else merged.
Equivalent to `e1 + -1 * e2`
Multiplies the coefficients rowwise with a given numeric vector. If the numeric vector is a `linear_transposed_vector`, it will multiply the vector with each variable per row.
Equivalent to `e2 * e1`
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 LinearVariableSum,numeric
*(e1, e2)# S4 method for numeric,LinearVariableSum
*(e1, e2)
# S4 method for LinearVariableSum,numeric
-(e1, e2)
# S4 method for numeric,LinearVariableSum
-(e1, e2)
# S4 method for LinearVariableSum,LinearVariableSum
+(e1, e2)
# S4 method for LinearVariableSum,LinearVariableSum
-(e1, e2)
# S4 method for LinearVariableSum,LinearVariableCollection
+(e1, e2)
# S4 method for LinearVariableCollection,LinearVariableSum
+(e1, e2)
# S4 method for LinearVariableCollection,LinearVariableSum
-(e1, e2)
# S4 method for LinearVariableSum,LinearVariableCollection
-(e1, e2)
# S4 method for LinearVariableSum,numeric
+(e1, e2)
# S4 method for numeric,LinearVariableSum
+(e1, e2)
# S4 method for LinearVariableSum,missing
-(e1, e2)
# S4 method for LinearVariableCollection,missing
-(e1, e2)
# S4 method for LinearVariableSum,missing
+(e1, e2)
# S4 method for LinearVariableCollection,missing
+(e1, e2)
# S4 method for LinearVariableCollection,numeric
+(e1, e2)
# S4 method for numeric,LinearVariableCollection
+(e1, e2)
# S4 method for LinearVariableCollection,numeric
-(e1, e2)
# S4 method for numeric,LinearVariableCollection
-(e1, e2)
# S4 method for LinearVariableCollection,numeric
/(e1, e2)
# S4 method for LinearVariableSum,numeric
/(e1, e2)
# S4 method for LinearVariableCollection,LinearVariableCollection
+(e1, e2)
# S4 method for LinearVariableCollection,LinearVariableCollection
-(e1, e2)
# S4 method for LinearVariableCollection,numeric
*(e1, e2)
# S4 method for numeric,LinearVariableCollection
*(e1, e2)
# S4 method for LinearVariableCollection,ANY,ANY,missing
[(x, i, j, ..., drop = TRUE)
Returns an object of type 'LinearVariableSum'
Returns an object of type 'LinearVariableSum'
Returns an object of type 'LinearVariableSum'
an object of type 'LinearVariableSum'
a new object of type 'LinearVariableCollection'
a numeric value
an object of type 'LinearVariableCollection'
an object of type 'LinearVariableCollection'
a numeric vector or a colwise vector/list
a numeric vector or a colwise vector/list
more a numeric vectors or a colwise vector/list
do not use this parameter
variables
a data frame hold the variable coefficients. One line for reach variable, row and column.
index_mapping
a function that takes a variable name as character and returns a mapping table that maps column ids to variable indexes.
variable
a linear variable collection with just one index '1'
constant
a numeric vector
variables
a variable collection
if (FALSE) {
# 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)]
}
Run the code above in your browser using DataLab