Re: [R] Matrix of dummy variables from a factor

From: Uwe Ligges <ligges_at_statistik.uni-dortmund.de>
Date: Wed 07 Dec 2005 - 08:05:51 EST

Charles H. Franklin wrote:

> What is a simple way to convert a factor into a matrix of dummy variables?
>
> fm<-lm(y~f)

  model.matrix(y~f)

Uwe Ligges

> where f is a factor takes care of this in the estimation. I'd like to
> save the result of expanding f into a matrix for later use.
>
> Thanks.
>
> Charles
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Dec 07 08:46:22 2005

This archive was generated by hypermail 2.1.8 : Wed 07 Dec 2005 - 09:37:33 EST