Skip to content
Back to formatted view

Raw Message

Message-ID: <39B6DDB9048D0F4DAD42CB26AAFF0AFAFED638@usctmx1106.merck.com>
Date: 2005-12-06T20:29:58Z
From: Liaw, Andy
Subject: Matrix of dummy variables from a factor

See ?model.matrix.

HTH,
Andy

From: Charles H. Franklin
> 
> What is a simple way to convert a factor into a matrix of 
> dummy variables?
> 
> fm<-lm(y~f)
> 
> 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
> 
> -- 
> 
> 
>  Charles H. Franklin
>  Professor, Political Science
>  University of Wisconsin, Madison
>  franklin at polisci.wisc.edu
>  chfrankl at wisc.edu
>  608-263-2022 (voice)
>  608-265-2663 (fax)
> 
> ______________________________________________
> R-help at 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
> 
>