## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----eval = FALSE-------------------------------------------------------------
# # climdex.pcic
# ci <- climdexInput.raw(
#   tmax, tmin, precip, tmax.dates, tmin.dates, prec.dates,
#   base.range = c(1961, 1990)
# )
# fd <- climdex.fd(ci)
# 
# # climatekit
# fd <- ck_frost_days(tmin, dates)

## ----eval = FALSE-------------------------------------------------------------
# ck_frost_days(tmin, dates)
# #> # period       value index        unit
# #> # 2020-01-01      72 frost_days   days
# #> # 2021-01-01      68 frost_days   days
# #> # ...

## ----eval = FALSE-------------------------------------------------------------
# ck_tx90p(tmax, dates, ref_start = 1981L, ref_end = 2010L)

## ----eval = FALSE-------------------------------------------------------------
# # Old climdex.pcic outputs
# old_fd <- climdex.fd(ci)
# old_txx <- climdex.txx(ci)
# 
# # New climatekit outputs
# new_fd  <- ck_frost_days(tmin, dates)
# new_txx <- ck_txx(tmax, dates)
# 
# # Compare; expect agreement up to NA-handling and base-period self-inclusion
# all.equal(old_fd, new_fd$value)
# all.equal(old_txx, new_txx$value)

