On Mar 5, 2012, at 2:56 PM, kevin123 wrote:


This is a portion of my data frame

MemberID    Specialty                 Surgery          Internal
1 42286978     Surgery                      NA                   NA
2 97903248     Internal                     NA                   NA
3  2759427      Internal                      NA                   NA
4 73570559    Surgery                        NA                  NA

There are four columns. In the Specialty column there are two options
Surgery/Internal, These options have there own columns.

I want to fill a column in with 0 or 1 depending on another columns input

I am finding it hard to figure out how to do the following:

   MemberID    Specialty                 Surgery          Internal
1  42286978     Surgery                      1                   0
2  97903248     Internal                     0                  1
3   2759427      Internal                      0                  1
4  73570559    Surgery                        1                0

You (user1250865) have already been given THREE answers on StackOverflow. Crossposting is deprecated. (Unless of course this is a homework problem and both kevin123 and user1250865 are in the same class. Then ... homework is also deprecated.

--

David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@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.

Reply via email to