library(knitr) opts_chunk$set(echo = TRUE, cache = TRUE, message = FALSE, out.width = '100%') root <- rprojroot::find_rstudio_root_file()
library(Carex.bipolar) library(ENMeval) species <- "canescens" load(paste0(root, "/analyses/output/fullspp_ENMeval/", species, "_modeval.rda")) #modeval
After examining output of ENMeval for each species.
if (species == "allspp") bestmodel <- "LQH_1.5" if (species == "canescens") bestmodel <- "LQH_2" if (species == "macloviana") bestmodel <- "LQ_1.5" if (species == "magellanica") bestmodel <- "LQ_1" if (species == "maritima") bestmodel <- "LQ_1.5" if (species == "microglochin") bestmodel <- "LQ_1"
maxmod <- modeval@models[[which(modeval@results$settings == bestmodel)]]
response(maxmod)
locs <- as.data.frame(readr::read_csv(file.path(root, "data/locs_30m.csv"))) ## Select only occurrences of this species (defined in makefile): if (species != "allspp") locs <- locs[locs$species == species, ]
bioclim.pres <- read_presclim()
## Raw Maxent values pres.pred.raw <- modeval@predictions[[bestmodel]] plot(pres.pred.raw, main = "Raw model predictions") ## Logistic predictions pres.pred <- predict(maxmod, bioclim.pres, args = c("outputformat=logistic")) # Plot plot(pres.pred) points(locs$longitude, locs$latitude, col = "black", pch = 20, cex = 0.5) # Save writeRaster(pres.pred, filename = paste0(root, "/analyses/output/fullspp_predictions/", species, "/", species, "_proj_pres.grd"), overwrite = TRUE)
pred.rcp45 <- combine_pred(maxmod, "rcp45") plot(pred.rcp45) writeRaster(pred.rcp45, filename = paste0(root, "/analyses/output/fullspp_predictions/", species, "/", species, "_proj_rcp45.grd"), overwrite = TRUE)
pred.rcp85 <- combine_pred(maxmod, "rcp85") plot(pred.rcp85) writeRaster(pred.rcp85, filename = paste0(root, "/analyses/output/fullspp_predictions/", species, "/", species, "_proj_rcp85.grd"), overwrite = TRUE)
devtools::session_info()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.