I have a data like that :
structure(list(Event = c(2015L, 2017L, 2015L, 2018L, 2016L, 2017L,
2015L, 2015L, 2015L)), class = "data.frame", row.names = c(NA,
-9L))
I want to make each year (value) separate and then make those columns binominal like this.
structure(list(X2015 = c(1L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L),
X2016 = c(0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L), X2017 = c(0L,
1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L), X2018 = c(0L, 0L, 0L, 1L,
0L, 0L, 0L, 0L, 0L)), class = "data.frame", row.names = c(NA,
-9L))
So it means making columns for each year.