df2matdf: Convert a response vector in a data frame to a matrix
Description
Convert a response vector in a data frame to a matrix
Usage
df2matdf(x, formula)
Value
A data.frame
Arguments
x
a data frame
formula
a formula
Details
This function identifies repeated combinations of explanatory variables
in a mgcvformula and then creates a \(n \times m\)
matrix response variable in which each row corresponds to one of
\(n\) unique explanatory variable combinations and each column to one of
\(m\) replicates with the combination. Here \(m\) is the maximum number
of replicates for an explanatory variable combination; rows of the matrix
are padded with NAs at the end where there are fewer than \(m\)
replicates.