Hadley Wickham's plyr package is the generic answer for how to do this kind
of data manipulation but it has a bit of a learning curve (although he has
nice tutorials on his site). I'm not completely positive but I think you
can get aggregate() to do this for you as well.
Brandon
On Sun, Apr 3, 2011 at 4:47 PM, Rachel Crouch
<rcrouch(a)jd12.law.harvard.edu>wrote;wrote:
Hi Michael,
I can't help you with R on this one, but it's relatively easy to do in
Excel with a vlookup. Less elegant and slower probably, but I can show you
how to do if nobody else comes up with a better answer.
Rachel
On Apr 3, 2011, at 4:25 PM, Michael Hankinson <mhankins(a)fas.harvard.edu>
wrote:
Hello everyone,
I'm trying to manipulate a data frame and I need your help. I working
with
Congressional committee assignments. Here is what the current data
frame looks like:
Name Year Committee
Aandahl 1951 102
Aandahl 1951 146
Aandahl 1952 102
Aandahl 1952 146
Basically, each representative has their committee listed. If they are
in more
than one committee that year, they receive two rows (one for each
committee).
What I want is to butcher this data set into a string of binary values
for each
committee, each year. Kind of like:
Year Name 102 103 104....145 146 147
1951 Aandahl 1 0 0 0 1 0
Any thoughts on how to pull this off?
Thank you in advance. I hope you are frolicking among the baby deer on
this
beautiful Sunday (rather than inhaling the stale air of the CGIS-K
Dungeon/Lab)
Mikey H!
_______________________________________________
gov2001-l mailing list
gov2001-l(a)lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
_______________________________________________
gov2001-l mailing list
gov2001-l(a)lists.fas.harvard.edu
http://lists.fas.harvard.edu/mailman/listinfo/gov2001-l
_______________________________________________
gov2001-l mailing list
gov2001-l(a)lists.fas.harvard.edu