[R] convert factor to indicator matrix

Thomas Mang thomas.mang at fiwi.at
Wed Jul 1 23:53:14 CEST 2009


Hi,

I am looking for a function which can convert a single factor (a 
vector), or a list of multiple factors, into the indicator (dummy) 
matrix with 0/1 entries (or other contrasting schemes). I could cook it 
myself, but I am actually sure this thing already exists - but forgot 
the name and package. IIRC it was clearly different from model.matrix, 
because it had a nicer, more straightforward interface [I know how to 
use model.matrix. I just can't figure out the other function any more].

many thanks,
Thomas




More information about the R-help mailing list