On 2/07/2009, at 9:53 AM, Thomas Mang wrote:

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].

It seems to me that

        m <- model.matrix(~x)

(where x is your factor) is pretty straightforward.  How much simpler
can it get?  The power of the formula concept is working for you here;
it would be hard to do without it.

        cheers,

                Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to