Running 'testthat.R' [39s/43s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
  > library(testthat)
  > library(SSDM)
  Welcome to the SSDM package, you can launch the graphical user interface by typing gui() in the console.
  > 
  > test_check("SSDM")
  -- 1. Error: ensemble function (@test_ensemble.R#7)  ---------------------------
  subscript out of bounds
  1: modelling("SVM", Occurrences, Env, Xcol = "LONGITUDE", Ycol = "LATITUDE", select.thresh = 0, 
         verbose = FALSE) at testthat/test_ensemble.R:7
  2: project(model, Env, ...)
  3: project(model, Env, ...)
  4: suppressWarnings(raster::predict(Env, model, fun = function(model, x) {
         x = as.data.frame(x)
         for (i in seq_len(length(Env@layers))) {
             if (Env[[i]]@data@isfactor) {
                 x[, i] = as.factor(x[, i])
                 x[, i] = droplevels(x[, i])
                 levels(x[, i]) = Env[[i]]@data@attributes[[1]]$ID
             }
         }
         return(predict(model, x))
     }))
  5: withCallingHandlers(expr, warning = function(w) invokeRestart("muffleWarning"))
  6: raster::predict(Env, model, fun = function(model, x) {
         x = as.data.frame(x)
         for (i in seq_len(length(Env@layers))) {
             if (Env[[i]]@data@isfactor) {
                 x[, i] = as.factor(x[, i])
                 x[, i] = droplevels(x[, i])
                 levels(x[, i]) = Env[[i]]@data@attributes[[1]]$ID
             }
         }
         return(predict(model, x))
     })
  7: raster::predict(Env, model, fun = function(model, x) {
         x = as.data.frame(x)
         for (i in seq_len(length(Env@layers))) {
             if (Env[[i]]@data@isfactor) {
                 x[, i] = as.factor(x[, i])
                 x[, i] = droplevels(x[, i])
                 levels(x[, i]) = Env[[i]]@data@attributes[[1]]$ID
             }
         }
         return(predict(model, x))
     })
  8: .local(object, ...)
  
  Error in factors[[j]] : subscript out of bounds
  Error in factors[[j]] : subscript out of bounds
  -- 2. Error: ensemble modelling function (@test_ensemble_modelling.R#5)  -------
  unable to find an inherited method for function 'ensemble' for signature '"missing"'
  1: ensemble_modelling(c("CTA", "MARS"), Occurrences, Env, rep = 1, Xcol = "LONGITUDE", 
         Ycol = "LATITUDE", ensemble.thresh = c(0), verbose = FALSE) at testthat/test_ensemble_modelling.R:5
  2: do.call(ensemble, algo)
  3: (new("nonstandardGenericFunction", .Data = function (x, ..., name = NULL, ensemble.metric = c("AUC"), 
         ensemble.thresh = c(0.75), weight = TRUE, thresh = 1001, uncertainty = TRUE, 
         verbose = TRUE, GUI = FALSE) 
     {
         return(standardGeneric("ensemble"))
     }, generic = structure("ensemble", package = "SSDM"), package = "SSDM", group = list(), 
         valueClass = character(0), signature = c("x", "name", "ensemble.metric", "ensemble.thresh", 
         "weight", "thresh", "uncertainty", "verbose", "GUI"), default = NULL, skeleton = (function (x, 
             ..., name = NULL, ensemble.metric = c("AUC"), ensemble.thresh = c(0.75), 
             weight = TRUE, thresh = 1001, uncertainty = TRUE, verbose = TRUE, GUI = FALSE) 
         stop("invalid call in method dispatch to 'ensemble' (no default method)", domain = NA))(x, 
             ..., name = name, ensemble.metric = ensemble.metric, ensemble.thresh = ensemble.thresh, 
             weight = weight, thresh = thresh, uncertainty = uncertainty, verbose = verbose, 
             GUI = GUI)))(thresh = 1001, uncertainty = TRUE, ensemble.metric = "AUC", 
         ensemble.thresh = 0, weight = TRUE, verbose = FALSE)
  4: (function (classes, fdef, mtable) 
     {
         methods <- .findInheritedMethods(classes, fdef, mtable)
         if (length(methods) == 1L) 
             return(methods[[1L]])
         else if (length(methods) == 0L) {
             cnames <- paste0("\"", vapply(classes, as.character, ""), "\"", collapse = ", ")
             stop(gettextf("unable to find an inherited method for function %s for signature %s", 
                 sQuote(fdef@generic), sQuote(cnames)), domain = NA)
         }
         else stop("Internal error in finding inherited methods; didn't return a unique method", 
             domain = NA)
     })(list(structure("missing", package = "methods")), new("nonstandardGenericFunction", 
         .Data = function (x, ..., name = NULL, ensemble.metric = c("AUC"), ensemble.thresh = c(0.75), 
             weight = TRUE, thresh = 1001, uncertainty = TRUE, verbose = TRUE, GUI = FALSE) 
         {
             return(standardGeneric("ensemble"))
         }, generic = structure("ensemble", package = "SSDM"), package = "SSDM", group = list(), 
         valueClass = character(0), signature = c("x", "name", "ensemble.metric", "ensemble.thresh", 
         "weight", "thresh", "uncertainty", "verbose", "GUI"), default = NULL, skeleton = (function (x, 
             ..., name = NULL, ensemble.metric = c("AUC"), ensemble.thresh = c(0.75), 
             weight = TRUE, thresh = 1001, uncertainty = TRUE, verbose = TRUE, GUI = FALSE) 
         stop("invalid call in method dispatch to 'ensemble' (no default method)", domain = NA))(x, 
             ..., name = name, ensemble.metric = ensemble.metric, ensemble.thresh = ensemble.thresh, 
             weight = weight, thresh = thresh, uncertainty = uncertainty, verbose = verbose, 
             GUI = GUI)), <environment>)
  5: stop(gettextf("unable to find an inherited method for function %s for signature %s", 
         sQuote(fdef@generic), sQuote(cnames)), domain = NA)
  
  Error in factors[[j]] : subscript out of bounds
  Error in factors[[j]] : subscript out of bounds
  Error in (function (classes, fdef, mtable)  : 
    unable to find an inherited method for function 'ensemble' for signature '"missing"'
  Error in factors[[j]] : subscript out of bounds
  Error in factors[[j]] : subscript out of bounds
  Error in (function (classes, fdef, mtable)  : 
    unable to find an inherited method for function 'ensemble' for signature '"missing"'
  Error in factors[[j]] : subscript out of bounds
  Error in factors[[j]] : subscript out of bounds
  Error in (function (classes, fdef, mtable)  : 
    unable to find an inherited method for function 'ensemble' for signature '"missing"'
  Error in factors[[j]] : subscript out of bounds
  Error in factors[[j]] : subscript out of bounds
  Error in (function (classes, fdef, mtable)  : 
    unable to find an inherited method for function 'ensemble' for signature '"missing"'
  Error in factors[[j]] : subscript out of bounds
  Error in factors[[j]] : subscript out of bounds
  Error in (function (classes, fdef, mtable)  : 
    unable to find an inherited method for function 'ensemble' for signature '"missing"'
  -- 3. Failure: stack modelling function (@test_stack_modelling.R#8)  -----------
  `SSDM` inherits from `NULL` not `Stacked.SDM`.
  
  Error in factors[[j]] : subscript out of bounds
  Error in factors[[j]] : subscript out of bounds
  -- 4. Error: stacking function (@test_stacking.R#6)  ---------------------------
  unable to find an inherited method for function 'ensemble' for signature '"missing"'
  1: ensemble_modelling(c("CTA", "SVM"), Occ1, Env, rep = 1, Xcol = "LONGITUDE", Ycol = "LATITUDE", 
         name = "elliptica", ensemble.thresh = 0, verbose = FALSE) at testthat/test_stacking.R:6
  2: do.call(ensemble, algo)
  3: (new("nonstandardGenericFunction", .Data = function (x, ..., name = NULL, ensemble.metric = c("AUC"), 
         ensemble.thresh = c(0.75), weight = TRUE, thresh = 1001, uncertainty = TRUE, 
         verbose = TRUE, GUI = FALSE) 
     {
         return(standardGeneric("ensemble"))
     }, generic = structure("ensemble", package = "SSDM"), package = "SSDM", group = list(), 
         valueClass = character(0), signature = c("x", "name", "ensemble.metric", "ensemble.thresh", 
         "weight", "thresh", "uncertainty", "verbose", "GUI"), default = NULL, skeleton = (function (x, 
             ..., name = NULL, ensemble.metric = c("AUC"), ensemble.thresh = c(0.75), 
             weight = TRUE, thresh = 1001, uncertainty = TRUE, verbose = TRUE, GUI = FALSE) 
         stop("invalid call in method dispatch to 'ensemble' (no default method)", domain = NA))(x, 
             ..., name = name, ensemble.metric = ensemble.metric, ensemble.thresh = ensemble.thresh, 
             weight = weight, thresh = thresh, uncertainty = uncertainty, verbose = verbose, 
             GUI = GUI)))(name = "elliptica", thresh = 1001, uncertainty = TRUE, ensemble.metric = "AUC", 
         ensemble.thresh = 0, weight = TRUE, verbose = FALSE)
  4: (function (classes, fdef, mtable) 
     {
         methods <- .findInheritedMethods(classes, fdef, mtable)
         if (length(methods) == 1L) 
             return(methods[[1L]])
         else if (length(methods) == 0L) {
             cnames <- paste0("\"", vapply(classes, as.character, ""), "\"", collapse = ", ")
             stop(gettextf("unable to find an inherited method for function %s for signature %s", 
                 sQuote(fdef@generic), sQuote(cnames)), domain = NA)
         }
         else stop("Internal error in finding inherited methods; didn't return a unique method", 
             domain = NA)
     })(list(structure("missing", package = "methods")), new("nonstandardGenericFunction", 
         .Data = function (x, ..., name = NULL, ensemble.metric = c("AUC"), ensemble.thresh = c(0.75), 
             weight = TRUE, thresh = 1001, uncertainty = TRUE, verbose = TRUE, GUI = FALSE) 
         {
             return(standardGeneric("ensemble"))
         }, generic = structure("ensemble", package = "SSDM"), package = "SSDM", group = list(), 
         valueClass = character(0), signature = c("x", "name", "ensemble.metric", "ensemble.thresh", 
         "weight", "thresh", "uncertainty", "verbose", "GUI"), default = NULL, skeleton = (function (x, 
             ..., name = NULL, ensemble.metric = c("AUC"), ensemble.thresh = c(0.75), 
             weight = TRUE, thresh = 1001, uncertainty = TRUE, verbose = TRUE, GUI = FALSE) 
         stop("invalid call in method dispatch to 'ensemble' (no default method)", domain = NA))(x, 
             ..., name = name, ensemble.metric = ensemble.metric, ensemble.thresh = ensemble.thresh, 
             weight = weight, thresh = thresh, uncertainty = uncertainty, verbose = verbose, 
             GUI = GUI)), <environment>)
  5: stop(gettextf("unable to find an inherited method for function %s for signature %s", 
         sQuote(fdef@generic), sQuote(cnames)), domain = NA)
  
  == testthat results  ===========================================================
  OK: 43 SKIPPED: 0 WARNINGS: 15 FAILED: 4
  1. Error: ensemble function (@test_ensemble.R#7) 
  2. Error: ensemble modelling function (@test_ensemble_modelling.R#5) 
  3. Failure: stack modelling function (@test_stack_modelling.R#8) 
  4. Error: stacking function (@test_stacking.R#6) 
  
  Error: testthat unit tests failed
  Execution halted