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       1996     2006 <int [11]> 96-06 FALSE    
#> 2       2006     2016 <int [11]> 06-16 FALSE    
#> 3       2016     2026 <int [11]> 16-26 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       1996     1996 <int [1]>  96-96 FALSE    
#> 2       1997     2006 <int [10]> 97-06 FALSE    
#> 3       2007     2016 <int [10]> 07-16 FALSE    
#> 4       2017     2026 <int [10]> 17-26 TRUE