Is there a better (more elegant) way of the one below in order to obtain a vector representing ranges filled with the first element of the range ?
years = collect(2000:2019)
step = 5
desired_res = [2000,2000,2000,2000,2000,2005,2005,2005,2005,2005,2010,2010,2010,2010,2010,2015,2015,2015,2015,2015]
What I have found:
period_ranges = collect(Iterators.partition(years[1]:years[end], step))
periods = [period_ranges[findfirst(p->in(y,p),period_ranges)][1] for y in years]