Generate a tibble of epochs.

make_epochs(
  start_year = 1987,
  end_year = 2020,
  epoch_step = 5,
  epoch_overlap = TRUE
)

Arguments

start_year

Minimum year in epochs

end_year

Maximum year in epochs

epoch_step

Numeric. How many years in an epoch?

epoch_overlap

Logical. Should epochs overlap by one year? i.e. epoch_step = 10 with epoch_overlap = TRUE gives, say, 2000-2010 and 2010-2020 whereas epoch_overlap = FALSE gives 2000-2009 and 2010-2019.

Value

Tibble with columns

start

First year of epoch

end

Last year of epoch

years

List column containing the years for the epoch

epoch

Last two digits of first year and last year in epoch. e.g. 10-19.

data

List column of full path of raster files to summarise.

Examples

now <- as.numeric(format(Sys.Date(), "%Y"))
make_epochs(now - 30, now, 10)
#> # A tibble: 3 × 5
#>   start_year end_year years      epoch epoch_now
#>        <dbl>    <dbl> <list>     <ord> <lgl>    
#> 1       1994     2004 <int [11]> 94-04 FALSE    
#> 2       2004     2014 <int [11]> 04-14 FALSE    
#> 3       2014     2024 <int [11]> 14-24 TRUE     
make_epochs(now - 30, now, 10, F)
#> # A tibble: 4 × 5
#>   start_year end_year years      epoch epoch_now
#>        <dbl>    <dbl> <list>     <ord> <lgl>    
#> 1       1994     1994 <int [1]>  94-94 FALSE    
#> 2       1995     2004 <int [10]> 95-04 FALSE    
#> 3       2005     2014 <int [10]> 05-14 FALSE    
#> 4       2015     2024 <int [10]> 15-24 TRUE