[R] Coding categorical variables in mixed environment

spime sabya23 at gmail.com
Sun Jun 10 10:44:42 CEST 2007


Hi R users,

Suppose we have following data for a regression model:

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

AGE      SEX      COLOR      RESPONSE
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.

bye

 
-- 
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.



More information about the R-help mailing list