added conditional to not run prediction if requirements are not met
This commit is contained in:
parent
dd1ee2b1a0
commit
ddad4240d5
|
|
@ -286,6 +286,10 @@ CI_quadrant <- readRDS(here(cumulative_CI_vals_dir,"All_pivots_Cumulative_CI_qu
|
||||||
group_by(model) %>% # Group by model or other relevant columns
|
group_by(model) %>% # Group by model or other relevant columns
|
||||||
fill(field, sub_field, .direction = "downup") %>% # Fill down then up within each group
|
fill(field, sub_field, .direction = "downup") %>% # Fill down then up within each group
|
||||||
ungroup()
|
ungroup()
|
||||||
|
if (all(is.na(CI_quadrant$tonnage_ha))) {
|
||||||
|
log_message("Lacking historic harvest data, please provide for yield prediction calculation")
|
||||||
|
knitr::knit_exit() # Exit the chunk if tonnage_ha is empty
|
||||||
|
}
|
||||||
|
|
||||||
harvesting_data <- harvesting_data %>% rename(season = year)
|
harvesting_data <- harvesting_data %>% rename(season = year)
|
||||||
|
|
||||||
|
|
@ -343,6 +347,10 @@ pred_rf_current_season <- prepare_predictions(predict(model_ffs_rf, newdata = pr
|
||||||
```
|
```
|
||||||
|
|
||||||
```{r yield_plaatjes, echo=FALSE }
|
```{r yield_plaatjes, echo=FALSE }
|
||||||
|
if (all(is.na(CI_quadrant$tonnage_ha))) {
|
||||||
|
log_message("Lacking historic harvest data, please provide for yield prediction calculation")
|
||||||
|
knitr::knit_exit() # Exit the chunk if tonnage_ha is empty
|
||||||
|
}
|
||||||
ggplot(pred_ffs_rf, aes(y = predicted_Tcha, x = tonnage_ha)) +
|
ggplot(pred_ffs_rf, aes(y = predicted_Tcha, x = tonnage_ha)) +
|
||||||
geom_point(size = 2, alpha = 0.6) + # Adjust point size and transparency
|
geom_point(size = 2, alpha = 0.6) + # Adjust point size and transparency
|
||||||
geom_abline(intercept = 0, slope = 1, linetype = "dashed", color = "red") + # Reference line
|
geom_abline(intercept = 0, slope = 1, linetype = "dashed", color = "red") + # Reference line
|
||||||
|
|
|
||||||
BIN
r_app/Rplots.pdf
BIN
r_app/Rplots.pdf
Binary file not shown.
Loading…
Reference in a new issue