Я думаю, что это делает то, что вам нужно.
#Creating the dataframe
country=c("Aghanistan","Aghanistan","Aghanistan","Brazil","Brazil","Brazil","China","China","China")
Indicator=c("ind1","ind2","ind3","ind1","ind2","ind3","ind1","ind2","ind3")
`1999`=c(745,19987071,0.373,NA,NA,NA,NA,NA,NA)
`2000`=c(2666,20595360,1.29,NA,NA,NA,NA,NA,NA)
df<-as.data.frame(cbind(country,Indicator,`1999`,`2000`))
library(tidyr)
df.long<-gather(df,Year,measurement,`1999`:`2000`,factor_key = T)#get the years right
df.final<-spread(df.long,Indicator,measurement)#reformat for final
df.final#scope the result