[R] coding for categorical variables with unequal observations

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Apr 4 07:40:03 CEST 2008

I think you need to do some background reading.  R does this automatically 
for you, and offers many options for how it is done.  (That you have asked 
suggests you have missed that.)

The account by Bill Venables in chapter 6 of MASS (the book, see the R 
FAQ) is regarded as the most comprehensive available.

On Thu, 3 Apr 2008, Tanya Yatsunenko wrote:

> Also, since I just started to use R, I have trouble generating and
> understanding some of the codes, especially choosing the correct ones.
> Thanks!
> tanya
> On Thu, Apr 3, 2008 at 3:54 PM, Tanya Yatsunenko <yata25 at gmail.com> wrote:
>> Hi,
>> I am doing multiple regression, and have several X variables that are
>> categorical.
>> I read that I can use dummy or contrast codes for that, but are there any
>> special rules when there're unequal #observations in each groups (4 females
>> vs 7 males in a "gender" variable)?
>> Also, can R generate these codes for me?
>> THanks.
> --
> Tanya
> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-help at 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.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list