I have a data frame like:
date county state score1 score2 FIPS
1 2018-01-21 Snohomish Washington 2 1 53061
2 2018-01-22 Snohomish Washington 1 0 53061
3 2018-01-23 Snohomish Washington 7 4 53061
4 2018-01-24 Cook Illinois 1 0 17031
5 2018-01-24 Cook Illinois 1 0 17031
6 2018-01-22 West Louisiana 3 4 1008
I would like to tally up the scores for different counties by matching them up by their FIPS. For example I want to sum up score1
of Snohomish county by using FIPS 53061
and then having 2+7+1 have a score1 for FIPS 53061 be 10. Score2
would equal 5.
I would like the final data frame to look like:
county state score1 score2 FIPS
Snohomish Washington 10 5 53061
Cook Illinois 2 0 17031
West Louisiana 3 4 1008
How can this be done?