[R] transforming character categories

Gregor Povh gregorpovh at yahoo.de
Sun Jun 28 10:25:24 CEST 2009



Dear R users,

apologies for this quite simple question.  I've tried serverall 
approaches, however, could not generate the desired result.

I have a large data frame, which has several cathegories encoded as 
character strings, for example.

Name, income, gender, ...
...  "from 1000$ to 2000$"  ...
...  "from 2000$  to 3000$" ...
...  "more than 3000$"        ...
...  "from 1000$ to 2000$"  ...
...  "from 1000$ to 2000$"  ...


How can I transform this column into numeric values for the categories, 
for example in somethins like this:
... 1000 ...
... 2000 ...
... 3000 ...
... 1000 ...
... 1000 ...




More information about the R-help mailing list