set.seed(1) sa <- sdm_area(parana, 0.1) sa <- add_predictors(sa, bioc) |> dplyr::select(c("bio1", "bio12")) sa <- add_scenarios(sa) suppressWarnings(oc <- occurrences_sdm(occ, crs=6933) |> join_area(sa)) test_that("plot works with i", { expect_no_error(plot(input_sdm(oc))) }) i <- input_sdm(oc, sa) test_that("plot works with i", { expect_no_error(plot(i)) }) i <- vif_predictors(i) suppressWarnings(i <- pseudoabsences(i, method = "bioclim")) ctrl_sdm <- caret::trainControl(method = "repeatedcv", number = 4, repeats = 10, classProbs = TRUE, returnResamp = "all", summaryFunction = summary_sdm, savePredictions = "all") suppressWarnings(i <- train_sdm(i, algo=c("mda", "kknn"), crtl=ctrl_sdm)) i <- predict_sdm(i) test_that("plot works with i", { expect_no_error(plot(i)) expect_no_error(plot_grid(i)) expect_no_error(mapview_grid(i)) expect_no_error(plot_occurrences(i)) expect_no_error(plot_occurrences(i, spp_name = "Araucaria angustifolia")) expect_error(plot_occurrences(i, spp_name = "a")) expect_no_error(mapview_occurrences(i)) expect_no_error(mapview_occurrences(i, spp_name = "Araucaria angustifolia")) expect_error(mapview_occurrences(i, spp_name = "a")) expect_no_error(plot_predictors(i)) expect_no_error(mapview_predictors(i)) expect_no_error(plot_predictions(i)) expect_no_error(plot_predictions(i, spp_name = "Araucaria angustifolia")) expect_error(plot_predictions(i, spp_name = "a")) expect_no_error(plot_predictions(i, scenario = "current")) #expect_error(plot_predictions(i, scenario = "a")) expect_no_error(plot_predictions(i, ensemble_type = "wmean_AUC")) expect_no_error(plot_predictions(i, ensemble_type = "committee_avg")) expect_error(plot_predictions(i, ensemble_type = "a")) expect_no_error(plot_predictions(i, ensemble = FALSE, id = "m1.1")) expect_no_error(plot_predictions(i, ensemble = FALSE, id = 1)) expect_error(plot_predictions(i, ensemble = FALSE, id = "a")) expect_no_error(mapview_predictions(i)) expect_no_error(mapview_predictions(i, spp_name = "Araucaria angustifolia")) expect_no_error(mapview_predictions(i, scenario = "current")) expect_no_error(mapview_predictions(i, ensemble_type = "wmean_AUC")) expect_no_error(mapview_predictions(i, ensemble_type = "committee_avg")) expect_error(mapview_predictions(i, ensemble_type = "a")) expect_no_error(mapview_predictions(i, ensemble = FALSE, id = "m1.1")) expect_no_error(mapview_predictions(i, ensemble = FALSE, id = 1)) expect_error(mapview_predictions(i, ensemble = FALSE, id = "a")) }) test_that("plot works with sa", { expect_no_error(plot_grid(sa)) expect_no_error(mapview_grid(sa)) expect_no_error(plot_predictors(sa)) expect_no_error(mapview_predictors(sa)) }) test_that("plot works with oc", { expect_no_error(plot_occurrences(oc)) expect_no_error(mapview_occurrences(oc)) })