[R] Coding categorical variables in mixed environment

From: spime <sabya23_at_gmail.com>
Date: Sun, 10 Jun 2007 01:44:42 -0700 (PDT)

Hi R users,

Suppose we have following data for a regression model:

SEX: male/female categorical
COLOR: {blue, green, pink} categorical
RESPONSE: yes/no categorical

10         M          BLUE         Y
12         M          GREEN       N
13         F           PINK         Y
11         M          BLUE         Y
13         M          GREEN       N
09         F           GREEN       N
15         F           BLUE         Y
11         F           PINK          Y
12         M          PINK          N
14         M          GREEN        N

I want to code the categorical data as {male =1, female =2}, {blue =1, green =2, pink = 3} {yes =1, no =0} and finally get the new table.

how can i do this?

waiting for reply. Thanks in advance.


View this message in context: http://www.nabble.com/Coding-categorical-variables-in-mixed-environment-tf3896721.html#a11046822
Sent from the R help mailing list archive at Nabble.com.

R-help_at_stat.math.ethz.ch mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Sun 10 Jun 2007 - 08:47:52 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 10 Jun 2007 - 11:31:49 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.