expand.mat {prefmod} | R Documentation |
The function expands aggregated data into casewise data. For instance, for a contingency table given in the form of a design matrix and corresponding counts the function sets up a matrix where each design row is repeated according to the frequencies for that row.
expand.mat(mat, freq)
mat |
a matrix (or column vector) or data frame to be expanded |
freq |
a vector of counts |
the expanded matrix
This utility allows to generate input data for the for the design generating
and model fitting functions of the prefmode
package
from aggregated data.
data(tennis) tdat<-expand.mat(tennis[,-1],tennis[,1]) head(tdat)