diff --git a/R/area-based.3.mapping.and.inference.Rmd b/R/area-based.3.mapping.and.inference.Rmd index 0e0a31096ded1432099dd1c564ce28d85549d15e..9c6a78af973ac4ecb46cb6ceef7f78072d921b64 100755 --- a/R/area-based.3.mapping.and.inference.Rmd +++ b/R/area-based.3.mapping.and.inference.Rmd @@ -432,11 +432,11 @@ public_cropped <- sf::st_crop(public, terra::ext(metrics_map)) Then the function `lidaRtRee::aba_predict` is used to produce the map. If the input is an object containing the stratified model and if the metrics map contains the strata layer, then the model directly maps the output by retaining the corresponding model in each stratum. -```{r mapForestStratified, include=TRUE, message=FALSE, warning=FALSE} +```{r mapForestStratified, include=TRUE, message=FALSE, warning=TRUE} # map with stratified model prediction_map_mixed <- lidaRtRee::aba_predict(model_aba_stratified_mixed, metrics_map, stratum = "stratum") # ISSUE in terra::merge 1.7.3 : NA values are not handled correctly ? -# WAITING for a fix so that stratified maps are correctly merged +# CORRECTED in 1.7.8 for a fix so that stratified maps are correctly merged # for checking purposes # extracted "private" stratum model from combined model model_private <- list(model = model_aba_stratified_mixed$model$private, stats = model_aba_stratified_mixed$stats["private", ]) @@ -447,9 +447,10 @@ model_public <- list(model = model_aba_stratified_mixed$model$public, stats = mo # produce corresponding map prediction_map_public <- lidaRtRee::aba_predict(model_public, metrics_map) # TEMPORARY fix to NA values in terra::merge (call by lidaRtRee::aba_predict) -if (packageVersion("terra")<"1.7.3" | packageVersion("terra")>="1.7.8") +if (packageVersion("terra")>="1.7.3" && packageVersion("terra")<"1.7.8") { - warning("Merging with terra::mosaic because terra::merge in 1.7.3 and 1.7.6 does not handle NA values") + packageVersion("terra") + warning("Manually merging with terra::mosaic because terra::merge in 1.7.3 and 1.7.6 does not handle NA values") prediction_map_mixed <- terra::mosaic(prediction_map_public, prediction_map_private, fun = max) } ```