[R] Factors? I think?

Totally Inept kramer877 at gmail.com
Fri Sep 9 01:36:18 CEST 2011


First of all, let me apologize, as this is probably an absurdly basic
question. I did search before asking, but perhaps my ineptitude didn't allow
me to apply what I read to what I'm doing. Totally new to R, and haven't
done any code in any language in a long time.

Basically I've got categories. They're department codes for doctors (say,
9999 for radiology or 5555 for endocrinology), which of course means that
there are a good number of them, i.e. it's not practical for me to write
them all out as I usually see in examples of categorical variables
(factors).

And then I've got a list of doctors that I'm actually interested in. I have
the department codes associated with each, but I need to map the department
name to the doctor name. So I might have Greg Jones, Bob Smith, Tom Wilson,
etc... to go with 1234, 9999, 2222, etc.

I need to turn Greg Jones, Bob Smith, ... and 1234, 9999, ... into Greg
Jones, Bob Smith, ... Cardiology, Radiology, .... 

Obviously I could just search and replace within the csv files but I need
something durable that I can run things through repeatedly. 

Anyhow, thanks to anyone willing to humor me with an answer.

--
View this message in context: http://r.789695.n4.nabble.com/Factors-I-think-tp3800413p3800413.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list