diff --git a/R/plot_mgt_harv.R b/R/plot_mgt_harv.R index c24872ceebf4ce1608b8e7c15ec0f5a3dac28f91..52db5c8149b0543c353595f628c030c042517e9b 100644 --- a/R/plot_mgt_harv.R +++ b/R/plot_mgt_harv.R @@ -270,7 +270,8 @@ prepare_phu <- function(mgt_out, years) { group_by(hru, year, op_typ) %>% # ungroup() %>% # filter(n_op > 1) %>% - mutate(date_diff = diff(date)) %>% + # mutate(date_diff = diff(date)) %>% + mutate(date_diff = lead(date)-date) %>% ##This line avoids error if only one year for crop is available without kill ungroup() %>% filter(year %in% years)