I have time series data across several sites with species presence absence across years. I want to see which species persisted, dropped or added at each site during the whole timeseries. I am only trying to compare the first and last year i.e. 2000 and 2002. The information of species should be saved in a separate column fate. I am pasting example of data and desired result. Any help is highly appreciated.
structure(list(site = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L), year = c(2000L, 2000L, 2000L, 2000L, 2001L,
2001L, 2001L, 2002L, 2002L, 2000L, 2000L, 2001L, 2001L, 2001L, 2001L,
2002L, 2002L), spe = c("A", "B", "C", "D", "B", "C", "D", "A", "D",
"A", "B", "A", "B", "C", "D", "C", "D")), class = "data.frame",
row.names = c(NA, -17L))