I have a data frame that's something like this
county type amount 1 a 10 1 b 5 2 a 3 2 b 5 2 b 1
I want to rearrange the data so that each county is one observation and there is one column for each type of county. So the resulting dataframe would look like
county type_a type_b 1 10 5 2 3 6
I've been trying to think of different ways to do this with my limited skills and can't think of anything other than creating a subset for each type, summing them, and then manually merging together into a new dataset... but there must be a cleaner way to do this. Any ideas?