I have a list of years ranging from 1920 to 2020. I need to convert them to their subsequent decades. How do I do that effortlessly in R? I was trying by writing nested if statements but it is becoming too long and tedious.
Sample from my data:
data <-structure(list(Years = c(1945L, 1987L, 1980L, 1963L, 2006L, 1995L,
1971L)), class = "data.frame", row.names = c(NA, -7L))
Desired output:
Any help would mean a lot!
