library(dplyr)
library(lmomco)
library(generics)
res <- tenterfield |>
mutate(month = lubridate::month(ym)) |>
init(id = id, time = ym, group = month) |>
compute_indexes(
spi = idx_spi(),
spei = idx_spei(.lat = lat, .tavg = tavg),
edi = idx_edi()
)
Run the code above in your browser using DataLab