Model matrix doesn't work as I thought. It worked on small, simple test data but I didn't test thoroughly enough or really understand what it was doing at it's core.
Redo prepDF function using dplyr instead of model matrix and formula. The only downside to this approach is that the model covariates will have to be specified within the package rather than within a particular analysis. This is because the current version of dplyr doesn't not allow a character list or vector in the select function. That is anticipated in future versions. There may be workarounds, I'll have to look.
Model matrix doesn't work as I thought. It worked on small, simple test data but I didn't test thoroughly enough or really understand what it was doing at it's core.
Redo prepDF function using dplyr instead of model matrix and formula. The only downside to this approach is that the model covariates will have to be specified within the package rather than within a particular analysis. This is because the current version of dplyr doesn't not allow a character list or vector in the select function. That is anticipated in future versions. There may be workarounds, I'll have to look.