I am trying to take data that looks like this:
Precinct Office Votes
1 auditor 10
1 president 9
2 auditor 6
2 president 8
to have 3 columns, precinct
, auditor
and president
, with the values being what is now Votes
. I have tried using dplyr::spread()
, but end up with something like this:
Precinct auditor president
1 10 NA
1 NA 9
2 6 NA
2 NA 8
How do I get rid of the staggered NA
s so that I have half as many rows, like this:
Precinct auditor president
1 10 9
2 6 8