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

From: Berton Gunter <gunter.berton_at_gene.com>
Date: Wed 07 Dec 2005 - 08:27:17 EST


But note: There are (almost?) no situations in R where the dummy variables coding is needed. The coding is (almost?) always handled properly by the modeling functions themselves.

Question: Can someone provide a "straightforward" example where the dummy variable coding **is** explicitly needed?

"The business of the statistician is to catalyze the scientific learning process." - George E. P. Box    

> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Liaw, Andy
> Sent: Tuesday, December 06, 2005 12:30 PM
> To: 'Charles H. Franklin'; r-help@stat.math.ethz.ch
> Subject: Re: [R] 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@polisci.wisc.edu
> > chfrankl@wisc.edu
> > 608-263-2022 (voice)
> > 608-265-2663 (fax)
> >
> > ______________________________________________
> > 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
> >
> >
>
> ______________________________________________
> 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
>



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:53:23 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:30 EST