[R] help

Daniel Mastropietro mastropi at uwalumni.com
Fri Jul 5 02:37:03 CEST 2002

Define the variable as a factor.
Suppose you have a response 'y' and a regressor 'x' that has the binary 
variables, then do:

lm(y ~ as.factor(x));

This is also valid for any categorical variable, not only for binary variables.

The function factor() may also be of interest to you.

At 01:27 PM 4/7/2002 -0700, elizabeth pino wrote:
>     Can you tell me how to do a regression
>    that include a binary variable in the function lm
>or some other?.
>  thank you for any help.

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list