## Selected calculations
## library(tidyverse) # only purrr used here for crop2 example
library(dplyr)
library(purrr)
stress_days_over(boonah, enddate = crop$flower_date[4], ndays = 3,
monitor = TRUE)
stress_days_over(boonah, enddate = crop$harvest_date[4], ndays = 3,
monitor = TRUE)
stress_days_over(boonah, startdate = crop$flower_date[4],
enddate = crop$harvest_date[4], monitor = TRUE)
## Add selected stress days at 'boonah' to 'crop' tibble
## using 'map2_dbl' from the 'purrr' package
## Note: using equivalent 'furrr' functions can speed up calculations
crop2 <- crop |>
mutate(stressdays25_post_sow_7d =
purrr::map_dbl(sowing_date, function(x)
stress_days_over(boonah, startdate = x, ndays = 7,
stress_temp = 25)),
stressdays_flower_harvest =
purrr::map2_dbl(flower_date, harvest_date, function(x, y)
stress_days_over(boonah, startdate = x, enddate = y)))
crop2
Run the code above in your browser using DataLab