I have a table that looks like this:
ID Start_year Status_2005 Status_2006 Status_2007
1 2005 GBR GBR FRA
2 2006 NA FRA FRA
3 2007 NA NA GBR
4 2006 NA UKR RUS
I would like to re-shape the data so that it gives the status in the years subsequent to the start year. So the above, would look like this:
ID Year_0 Year_1 Year_2
1 GBR GBR GBR
2 FRA FRA NA
3 GBR NA NA
4 UKR RUS NA
I have been trying to use tidyverse in R, using gather in combination with "starts_with", and mutate to make the new columns. However, I keep ending up with a single column of "years_since_start_year", and can't work out how to spread this column to make my final table.
Any help much appreciated