How can I create a new dataframe comparing values and getting only most recent data in R?
问题 I have a data frame that has the data from the Gini Index of countries. Plenty of the values are NA , so i want to create a new data frame that has, for each country, the most recent Gini Index measured for it. For example, if Brazil has a value for 2012, 2013 and 2015, the new data frame will have only the value of 2015. This is how the data looks like: Country.Name Country.Code X2014 X2015 X2016 X2017 8 Argentina ARG 41.4 NA 42.4 NA 9 Armenia ARM 31.5 32.4 32.5 NA 13 Austria AUT 30.5 30.5