Skip to content

ERROR: "attempt to set 'colnames' on an object with less than two dimensions" #348

@THccaa

Description

@THccaa

I ran into this error:

1] "1 species_1"
[1] "2 species_2"
N.grid cellSize.pp. Imoran.Grid.P Eucl.Grid.P Sd.Grid.P
14     14    0.3827586         0.215       0.669     0.157
N.grid cellSize.pp. Imoran.Grid.P Eucl.Grid.P Sd.Grid.P
4      4    0.1011494         0.246       0.679     0.013
Error in { : 
    task 1 failed - "attempt to set 'colnames' on an object with less than two dimensions"

When running traceback(), I get these results:

  5: stop(simpleError(msg, call = expr))
  4: e$fun(obj, substitute(ex), parent.frame(), e$data)
  3: foreach(s = 1:length(RecordsData), .packages = c("raster", "dismo", 
                                                      "rgdal"), .export = c("inv_bio", "inv_geo", "KM_BLOCK", "OptimRandomPoints")) %dopar% 
    {
      rgdal::setCPLConfigOption("GDAL_PAM_ENABLED", "FALSE")
      print(paste(s, SpNames[s]))
      presences <- RecordsData[[s]]
      mask2 <- mask
      mask2[] <- 0
      presences2 <- data.frame(pa = c(rep(1, nrow(presences))), 
                               presences)
      sp::coordinates(presences2) = presences2[, c("x", "y")]
      raster::crs(presences2) <- raster::projection(mask)
      DIM <- matrix(0, length(cellSize), 2)
      colnames(DIM) <- c("R", "C")
      DIM
      part <- data.frame(matrix(0, nrow(presences2@data), nrow(DIM)))
      part2 <- list()
      for (i in 1:length(cellSize)) {
        mask3 <- mask2
        res(mask3) <- cellSize[i]
        ...
   2: BlockPartition_TMLA(evnVariables = envT, RecordsData = occ_xy, 
                               N = 2, pseudoabsencesMethod = pseudoabs_method["method"], 
                               PrAbRatio = pres_abs_ratio, DirSave = DirB, DirM = DirM, 
                               MRst = sp_accessible_area["method"], type = TipoMoran, Geo_Buf = Geo_Buf, 
                               cores = cores)
   1: ENMTML(pred_dir = "./Predictions/", proj_dir = NULL, result_dir = "ENM_Results", 
                  occ_file = "Occurrences/occurences_SAH.txt", "Species", "Longitude", 
                  "Latitude", min_occ = 10, thin_occ = NULL, eval_occ = NULL, 
                  colin_var = c(method = "PEARSON", threshold = "0.7"), imp_var = TRUE, 
                  sp_accessible_area = c(method = "BUFFER", type = "1"), pseudoabs_method = c(method = "GEO_ENV_KM_CONST", 
                                                                                              width = "50"), pres_abs_ratio = 1, part = c(method = "BLOCK"), 
                  save_part = T, save_final = TRUE, algorithm = c("SVM", "RDF", 
                                                                  "MXD"), thr = c(type = "MAX_TSS"), msdm = NULL, ensemble = NULL, 
                  extrapolation = FALSE, cores = 2)

Unfortunately, that does not tell me anything. I do not understand which object is supposed to have more than two dimensions and, more importantly, why it doesn't have two or how to find it out.

I'd be glad to hear some ideas. Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions