Hello,
I would like to take a data set of doctors, and recategorize them into
numbers.
For example,
John Doe would be assigned as 1
Jane Doe would be assigned as 2
Does anyone know how to do this in R? It seems quite easy, yet I cannot
find the code.
Thank you,
Michael Leitson
Research Intern
MSAS Candidate
Michael.Leitson@wellstar.org
________________________________________________
This email and any files transmitted with it may contain
confidential and /or proprietary information in the possession
of WellStar Health System, Inc. ("WellStar") and is intended
only for the individual or entity to whom addressed. This email
may contain information that is held to be privileged, confidential
and exempt from disclosure under applicable law. If the reader
of this message is not the intended recipient, you are hereby
notified that any unauthorized access, dissemination, distribution
or copying of any information from this email is strictly prohibited,
and may subject you to criminal and/or civil liability. If you have
received this email in error, please notify the sender by reply email
and then delete this email and its attachments from your computer.
- Thank you.
[[alternative HTML version deleted]]
On Tue, Sep 25, 2012 at 2:22 PM, Michael Leitson <Michael.Leitson at wellstar.org> wrote:> Hello, > > I would like to take a data set of doctors, and recategorize them into > numbers. > > For example, > > John Doe would be assigned as 1 > Jane Doe would be assigned as 2 > > Does anyone know how to do this in R? It seems quite easy, yet I cannot > find the code. > > Thank you, > >Try something like as.numeric(factor(x)) This works because factors are internally coded as one integer per unique level. Cheers, Michael> Michael Leitson > > Research Intern > MSAS Candidate > Michael.Leitson at wellstar.org > > > ________________________________________________ > This email and any files transmitted with it may contain > confidential and /or proprietary information in the possession > of WellStar Health System, Inc. ("WellStar") and is intended > only for the individual or entity to whom addressed. This email > may contain information that is held to be privileged, confidential > and exempt from disclosure under applicable law. If the reader > of this message is not the intended recipient, you are hereby > notified that any unauthorized access, dissemination, distribution > or copying of any information from this email is strictly prohibited, > and may subject you to criminal and/or civil liability. If you have > received this email in error, please notify the sender by reply email > and then delete this email and its attachments from your computer. > - Thank you. > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Unless you have good reason and know what you're doing, **don't do this!** It is just asking for trouble. ... and yes, it is easy. Have you gone through the "Intro to R" tutorial that I believe would provide you the information to do this? Cheers, Bert On Tue, Sep 25, 2012 at 6:22 AM, Michael Leitson <Michael.Leitson at wellstar.org> wrote:> Hello, > > I would like to take a data set of doctors, and recategorize them into > numbers. > > For example, > > John Doe would be assigned as 1 > Jane Doe would be assigned as 2 > > Does anyone know how to do this in R? It seems quite easy, yet I cannot > find the code. > > Thank you, > > > Michael Leitson > > Research Intern > MSAS Candidate > Michael.Leitson at wellstar.org > > > ________________________________________________ > This email and any files transmitted with it may contain > confidential and /or proprietary information in the possession > of WellStar Health System, Inc. ("WellStar") and is intended > only for the individual or entity to whom addressed. This email > may contain information that is held to be privileged, confidential > and exempt from disclosure under applicable law. If the reader > of this message is not the intended recipient, you are hereby > notified that any unauthorized access, dissemination, distribution > or copying of any information from this email is strictly prohibited, > and may subject you to criminal and/or civil liability. If you have > received this email in error, please notify the sender by reply email > and then delete this email and its attachments from your computer. > - Thank you. > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm