I have the following dataset:
Country/Region 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 GDP per Capita
Albania 3.9 4.5 3.9 4.2 4.5 4.9 5.2 6.2 7.5 7.6 6.4 6.7 7.3 7.6 7.2 7.2 7.5 7.6 7.2 6.3 4.4 2.8 2.3 2.3 1.9 1.9 1.4 1.7 3.0 3.1 3.3 3.8 4.0 4.3 4.1 4.0 4.0 3.9 3.5 3.8 5,626
Austria 48.7 50.5 54.0 51.3 50.2 54.3 51.8 54.5 57.2 55.7 52.8 51.0 51.1 52.9 54.3 53.2 54.2 52.1 52.5 56.4 60.6 55.7 56.0 56.2 59.4 63.1 62.4 62.9 61.4 61.7 65.9 67.4 72.6 73.7 74.6 72.5 70.0 70.6 63.5 69.3 56,259
Belarus 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 124.5 119.4 98.8 82.9 70.2 61.4 62.7 61.8 59.3 57.6 58.7 57.8 59.2 60.7 63.0 62.1 66.2 64.0 64.5 62.3 65.3 6,575
Belgium 116.8 126.7 132.7 130.6 115.6 124.5 123.5 129.0 132.3 125.7 115.5 109.3 100.6 102.6 101.9 102.6 102.8 104.6 105.9 107.9 113.3 112.3 109.8 115.5 115.2 121.3 118.5 120.9 117.4 118.6 119.1 111.9 119.5 116.5 112.6 109.6 105.6 111.0 100.7 106.4 51,237
Bosnia and Herzegovina 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 23.7 21.2 15.6 13.1 3.0 3.2 4.1 8.3 10.5 10.2 13.5 13.3 14.0 14.3 15.0 15.6 17.2 18.2 19.9 19.4 19.9 6,140
Bulgaria 62.8 64.8 66.6 67.7 72.2 72.1 74.8 77.9 81.1 83.8 79.9 81.5 80.2 78.3 81.1 82.1 83.1 82.1 81.4 74.8 56.4 54.1 55.1 52.5 53.2 53.8 50.9 48.7 42.8 42.1 44.8 42.0 46.3 45.4 45.9 47.3 50.4 49.0 42.2 43.8 9,811
Croatia 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 21.6 15.7 15.2 15.8 15.0 15.8 15.6 17.3 18.4 18.3 17.7 18.6 19.6 21.0 20.4 20.8 20.8 22.1 21.0 19.8 19.0 15,533
Cyprus 1.8 2.2 2.3 1.8 1.7 2.0 2.1 2.3 2.5 2.6 2.5 2.6 2.7 2.8 2.8 3.1 3.6 3.6 3.8 3.8 4.4 4.7 4.9 5.3 5.2 5.5 5.7 5.8 6.0 6.3 6.2 6.3 7.0 6.9 7.0 7.1 7.3 7.6 7.5 7.2 30,521
Czech Republic 151.0 150.0 147.1 146.3 152.6 157.4 166.9 163.0 172.5 165.8 166.5 169.3 170.5 173.1 173.1 173.1 174.2 170.8 163.5 155.1 140.9 131.4 126.7 120.2 123.7 125.6 124.0 117.6 110.9 121.9 121.4 117.2 120.7 121.8 119.6 120.7 122.0 117.3 110.1 114.5 26,114
Denmark 55.0 57.1 56.0 49.8 52.5 58.1 59.7 59.2 62.7 62.5 52.5 54.6 51.3 52.9 60.5 61.1 59.3 55.5 49.8 50.4 60.5 54.8 57.1 61.0 58.0 71.2 61.6 57.7 54.6 50.6 52.2 51.9 57.1 51.6 48.3 56.0 51.4 48.4 46.7 47.0 66,196
Estonia 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 36.1 32.1 23.5 18.0 17.8 16.1 17.0 16.5 16.0 14.9 14.6 15.1 14.6 16.6 16.7 16.9 15.5 19.3 17.7 14.7 18.5 25,260
Finland 39.8 43.7 48.0 44.5 44.4 50.5 50.2 54.7 54.4 55.2 46.0 44.5 43.2 44.4 48.6 49.5 53.8 53.1 52.9 54.4 55.9 53.7 54.8 61.4 56.0 62.2 60.1 56.8 56.1 55.1 60.3 63.0 70.8 67.2 55.2 66.8 65.0 57.0 55.0 62.9 54,869
France 431.9 448.6 484.8 464.6 430.6 469.3 455.3 474.7 481.8 461.4 414.1 396.7 381.0 369.5 360.3 347.8 342.3 340.5 355.9 352.3 379.6 368.0 348.9 344.4 353.8 368.6 361.7 385.3 377.7 376.9 383.8 375.9 385.2 385.4 388.4 379.6 373.1 370.2 351.4 357.8 46,493
Germany 978.6 1003.2 1053.1 1028.5 975.5 1032.2 1017.2 1055.9 1103.6 1055.6 1022.3 982.3 983.9 1006.1 1014.6 1016.3 1007.2 1001.2 976.8 949.7 924.8 886.5 879.9 868.5 867.8 896.5 865.8 858.9 826.9 825.0 843.3 830.7 839.8 840.8 809.0 820.9 796.3 800.1 747.1 761.6 53,276
Greece 25.2 29.2 34.1 32.6 34.5 39.1 40.4 42.8 45.1 45.3 44.9 46.3 49.3 51.0
(Sorry for the horrible formatting).
There are 41 countries and the years go from 1971-2010. The data for the years is CO2 emissions per capita.
However, due to the nature of the csv, I had to delete the first 2 rows of the dataset. I am not allowed to modify the csv, only manipulate the output in R.
I want to group the years together under a variable called "CO2 emissions per capita" so that it can be used in graphs, but still have individual columns for the years. I have managed to create the format using this code:
knitr::kable(europe.GDP) %>%
kable_styling(bootstrap_options = c("striped", "condensed", "interactive", "bordered", "responsive"),
full_width = TRUE, font_size = 12, fixed_thead = TRUE) %>%
add_header_above(c("", "CO2 Emissions per country" = 41),
font_size = 14) %>%
column_spec(1, bold = TRUE) %>%
row_spec(row = 0, font_size = 14, bold = TRUE) %>%
scroll_box(width = "100%", height = "800px")
but don't know how to make CO2 emissions a variable as opposed to every year being its own variable. I am very new to r, so I'm sorry if I'm not explaining what I'm trying to do very well.