I recently work with data sets that are in the following order:
country year ...
Albania 2012 ...
Albania 2013 ...
Albania 2014 ...
Albania 2015 ...
Albania 2016 ...
Bulgaria 2012 ...
Bulgaria 2013 ...
Bulgaria 2014 ...
Bulgaria 2015 ...
Bulgaria 2016 ...
... ...
... ...
I often need to add a new column to the data set before analysis, but the presence of the year column make it slightly more complicated for me. Imagine a second data set like:
country year gdp
Albania 1970 12111
Albania 1971 12222
... ... ...
Albania 2016 22333
... ... ...
Bulgaria 1970 15333
Bulgaria 1971 15444
... ... ...
How can I merge the above two data sets in a way that makes sure that the gdp value goes to right country-year row?
Thank you.