I'm not even sure how to describe what I want to achieve so I apologize for the unhelpful title.
Say I have a data frame with 3 columns: countries, year and population (ignore the population numbers, I just made them up)
Countries | Year | Population
| |
Japan | 1950 | 50
Japan | 1990 | 70
Australia | 1950 | 25
Australia | 1990 | 50
Russia | 1950 | 75
Russia | 1990 | 100
China | 1950 | 125
China | 1990 | 150
I know that there are only two unique years (1950 and 1990) for every country. I want to turn it into this table
Population
Country | 1950 | 1990
---------|-----------------------
Japan | 50 | 70
Australia| 25 | 50
Russia | 75 | 100
China | 125 | 150
How do I do this?