I want to modify the longitudinal data.
How can I create the column using the number in the column name(e.g. gdpPercap_1952, gdpPercap_1957, etc.)?
I try to divide by the number(year) and the letter(gdp) in those column(e.g. gdpPercap_1952, gdpPercap_1957, etc.). Then I try to make the new column "year".
Would you tell me how I can solve that? Or is there any other suitable way?
continent country gdpPercap_1952
1 Africa Algeria 2449.0082
2 Africa Angola 3520.6103
3 Africa Benin 1062.7522
4 Africa Botswana 851.2411
5 Africa Burkina Faso 543.2552
6 Africa Burundi 339.2965
gdpPercap_1957 gdpPercap_1962
1 3013.9760 2550.8169
2 3827.9405 4269.2767
3 959.6011 949.4991
4 918.2325 983.6540
5 617.1835 722.5120
6 379.5646 355.2032
gdpPercap_1967 gdpPercap_1972
1 3246.9918 4182.6638
2 5522.7764 5473.2880
3 1035.8314 1085.7969