[R] How to properly build model matrices

2012-02-09 Thread Yang Zhang
I always bump into a few (very minor) problems when building model matrices with e.g.: train = model.matrix(label~., read.csv('train.csv')) target = model.matrix(label~., read.csv('target.csv')) (1) The two may have different factor levels, yielding different matrices. I usually first rbind the

Re: [R] How to properly build model matrices

2012-02-11 Thread Uwe Ligges
On 09.02.2012 22:39, Yang Zhang wrote: I always bump into a few (very minor) problems when building model matrices with e.g.: train = model.matrix(label~., read.csv('train.csv')) target = model.matrix(label~., read.csv('target.csv')) (1) The two may have different factor levels, yielding diff