This utility function expands a matrix or data frame to an indicator supermatrix and optionally converts this to a data frame again. By default NA becomes zero and constant rows and columns are eliminated.
expandFrame(tab, clean =TRUE, zero =TRUE, returnFrame =TRUE)
Arguments
tab: Data frame (factors). Missings are coded as NA.
clean: If TRUE, rows and colums with 0 margins in data frame are deleted.
zero: If TRUE, NA's are replaced by 0.
returnFrame: If TRUE, a data frame is returned; if FALSE a matrix.