Running ‘test-all.R’ [3s/3s]
Running the tests in ‘tests/test-all.R’ failed.
Complete output:
  > library(testthat)
  > test_check("cleangeo")
  Loading required package: cleangeo
  Loading required package: rgeos
  rgeos version: 0.3-26, (SVN revision 560)
   GEOS runtime version: 3.6.2-CAPI-1.10.2 4d2925d6 
   Linking to sp version: 1.2-7 
   Polygon checking: TRUE 
  
  Loading required package: maptools
  Loading required package: sp
  Checking rgeos availability: TRUE
  ── 1. Error: clgeo_Clean (@test_Clean.R#49)  ───────────────────────────────────
  unable to find an inherited method for function 'row.names<-' for signature '"SpatialPolygons", "character"'
  1: clgeo_Clean(sp, verbose = FALSE) at testthat/test_Clean.R:49
  2: applyHandler(1:length(sp), function(x) {
         polygon <- slot(sp, "polygons")[[x]]
         ID <- slot(polygon, "ID")
         if (!all(is.na(nv))) {
             if (x %in% nv) {
                 polygons <- slot(polygon, "Polygons")
                 poly.nb <- length(polygons)
                 removedHoles <- vector()
                 if (poly.nb > 0) {
                     newpolygons <- list()
                     for (i in 1:poly.nb) {
                       if (slot(polygons[[i]], "hole")) {
                         if (dim(unique(slot(polygons[[i]], "coords")))[1] < 3) {
                           if (length(removedHoles) == 0 & verbose) {
                             logger.info(sprintf("Cleaning orphaned holes at index %s", 
                               x))
                           }
                           removedHoles <- c(removedHoles, i)
                         }
                         else {
                           newpolygon <- polygons[[i]]
                           slot(newpolygon, "hole") <- TRUE
                           newpolygons <- c(newpolygons, newpolygon)
                         }
                       }
                       else {
                         newpolygon <- polygons[[i]]
                         slot(newpolygon, "hole") <- FALSE
                         newpolygons <- c(newpolygons, newpolygon)
                       }
                     }
                     slot(polygon, "Polygons") <- newpolygons
                 }
                 polygon <- SpatialPolygons(Srl = list(polygon))
                 isValid <- report[x, ]$valid
                 if (length(removedHoles) > 0) {
                     if (verbose) {
                       logger.info(sprintf("Checking geometry validity at index %s", x))
                     }
                     tryCatch({
                       slot(polygon, "polygons") <<- lapply(slot(polygon, "polygons"), 
                         checkPolygonsHoles)
                     }, warning = function(msg) {
                       if (verbose) 
                         logger.info(sprintf("Catched MAPTOOLS warning '%s'", msg))
                     }, error = function(err) {
                       if (verbose) 
                         logger.info(sprintf("Catched MAPTOOLS error '%s'", err))
                     })
                     isValid <<- clgeo_IsValid(polygon, verbose)
                 }
                 if (is.null(errors.only) & !isValid) {
                     if (verbose) {
                       report.msg <- NULL
                       if (!is.na(report[x, "error_msg"])) {
                         report.msg <- report[x, "error_msg"]
                       }
                       else if (!is.na(report[x, "warning_msg"])) {
                         report.msg <- report[x, "warning_msg"]
                       }
                       logger.info(sprintf("Cleaning geometry at index %s (%s)", x, report.msg))
                     }
                     if (strategy == "POLYGONATION") {
                       polygon <- clgeo_CleanByPolygonation.SpatialPolygons(polygon, verbose)
                     }
                     else if (strategy == "BUFFER") {
                       attempt <- 1
                       polygon <- gBuffer(polygon, id = ID, width = 0)
                       while (attempt < 3) {
                         if (!clgeo_IsValid(polygon, verbose)) {
                           attempt <- attempt + 1
                           polygon <- gBuffer(polygon, id = ID, width = 0)
                         }
                         else {
                           break
                         }
                       }
                     }
                 }
                 if (!is.null(polygon)) {
                     polygon <- polygon@polygons[[1]]
                     slot(polygon, "ID") <- ID
                 }
                 else {
                     if (verbose) {
                       logger.info(sprintf("Removing false polygon at index %s", x))
                     }
                 }
             }
         }
         return(polygon)
     })
  3: lapply(X, FUN, ...)
  4: FUN(X[[i]], ...)
  5: clgeo_CleanByPolygonation.SpatialPolygons(polygon, verbose)
  6: unlist(lapply(sp@polygons, clgeo_CleanByPolygonation.Polygons, verbose))
  7: lapply(sp@polygons, clgeo_CleanByPolygonation.Polygons, verbose)
  8: FUN(X[[i]], ...)
  9: gUnionCascaded(trsp, sapply(trsp@polygons, slot, "ID"))
  10: TopologyFunc(groupID(spgeom[ids[[i]]], id[ids[[i]]]), names(ids)[i], TRUE, "rgeos_unioncascaded")
  11: unique(row.names(spgeom))
  12: row.names(spgeom)
  13: groupID(spgeom[ids[[i]]], id[ids[[i]]])
  14: `row.names<-`(`*tmp*`, value = ids)
  15: (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("SpatialPolygons", package = "sp"), "character"), new("standardGeneric", 
         .Data = function (x, value) 
         standardGeneric("row.names<-"), generic = structure("row.names<-", package = "rgeos"), 
         package = "rgeos", group = list(), valueClass = character(0), signature = c("x", 
         "value"), default = NULL, skeleton = (function (x, value) 
         stop("invalid call in method dispatch to 'row.names<-' (no default method)", 
             domain = NA))(x, value)), <environment>)
  16: stop(gettextf("unable to find an inherited method for function %s for signature %s", 
         sQuote(fdef@generic), sQuote(cnames)), domain = NA)
  
  ── 2. Error: Clean - 'bowtie' polygons (@test_Clean.R#69)  ─────────────────────
  unable to find an inherited method for function 'row.names<-' for signature '"SpatialPolygons", "character"'
  1: clgeo_Clean(sp) at testthat/test_Clean.R:69
  2: applyHandler(1:length(sp), function(x) {
         polygon <- slot(sp, "polygons")[[x]]
         ID <- slot(polygon, "ID")
         if (!all(is.na(nv))) {
             if (x %in% nv) {
                 polygons <- slot(polygon, "Polygons")
                 poly.nb <- length(polygons)
                 removedHoles <- vector()
                 if (poly.nb > 0) {
                     newpolygons <- list()
                     for (i in 1:poly.nb) {
                       if (slot(polygons[[i]], "hole")) {
                         if (dim(unique(slot(polygons[[i]], "coords")))[1] < 3) {
                           if (length(removedHoles) == 0 & verbose) {
                             logger.info(sprintf("Cleaning orphaned holes at index %s", 
                               x))
                           }
                           removedHoles <- c(removedHoles, i)
                         }
                         else {
                           newpolygon <- polygons[[i]]
                           slot(newpolygon, "hole") <- TRUE
                           newpolygons <- c(newpolygons, newpolygon)
                         }
                       }
                       else {
                         newpolygon <- polygons[[i]]
                         slot(newpolygon, "hole") <- FALSE
                         newpolygons <- c(newpolygons, newpolygon)
                       }
                     }
                     slot(polygon, "Polygons") <- newpolygons
                 }
                 polygon <- SpatialPolygons(Srl = list(polygon))
                 isValid <- report[x, ]$valid
                 if (length(removedHoles) > 0) {
                     if (verbose) {
                       logger.info(sprintf("Checking geometry validity at index %s", x))
                     }
                     tryCatch({
                       slot(polygon, "polygons") <<- lapply(slot(polygon, "polygons"), 
                         checkPolygonsHoles)
                     }, warning = function(msg) {
                       if (verbose) 
                         logger.info(sprintf("Catched MAPTOOLS warning '%s'", msg))
                     }, error = function(err) {
                       if (verbose) 
                         logger.info(sprintf("Catched MAPTOOLS error '%s'", err))
                     })
                     isValid <<- clgeo_IsValid(polygon, verbose)
                 }
                 if (is.null(errors.only) & !isValid) {
                     if (verbose) {
                       report.msg <- NULL
                       if (!is.na(report[x, "error_msg"])) {
                         report.msg <- report[x, "error_msg"]
                       }
                       else if (!is.na(report[x, "warning_msg"])) {
                         report.msg <- report[x, "warning_msg"]
                       }
                       logger.info(sprintf("Cleaning geometry at index %s (%s)", x, report.msg))
                     }
                     if (strategy == "POLYGONATION") {
                       polygon <- clgeo_CleanByPolygonation.SpatialPolygons(polygon, verbose)
                     }
                     else if (strategy == "BUFFER") {
                       attempt <- 1
                       polygon <- gBuffer(polygon, id = ID, width = 0)
                       while (attempt < 3) {
                         if (!clgeo_IsValid(polygon, verbose)) {
                           attempt <- attempt + 1
                           polygon <- gBuffer(polygon, id = ID, width = 0)
                         }
                         else {
                           break
                         }
                       }
                     }
                 }
                 if (!is.null(polygon)) {
                     polygon <- polygon@polygons[[1]]
                     slot(polygon, "ID") <- ID
                 }
                 else {
                     if (verbose) {
                       logger.info(sprintf("Removing false polygon at index %s", x))
                     }
                 }
             }
         }
         return(polygon)
     })
  3: lapply(X, FUN, ...)
  4: FUN(X[[i]], ...)
  5: clgeo_CleanByPolygonation.SpatialPolygons(polygon, verbose)
  6: unlist(lapply(sp@polygons, clgeo_CleanByPolygonation.Polygons, verbose))
  7: lapply(sp@polygons, clgeo_CleanByPolygonation.Polygons, verbose)
  8: FUN(X[[i]], ...)
  9: gUnionCascaded(trsp, sapply(trsp@polygons, slot, "ID"))
  10: TopologyFunc(groupID(spgeom[ids[[i]]], id[ids[[i]]]), names(ids)[i], TRUE, "rgeos_unioncascaded")
  11: unique(row.names(spgeom))
  12: row.names(spgeom)
  13: groupID(spgeom[ids[[i]]], id[ids[[i]]])
  14: `row.names<-`(`*tmp*`, value = ids)
  15: (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("SpatialPolygons", package = "sp"), "character"), new("standardGeneric", 
         .Data = function (x, value) 
         standardGeneric("row.names<-"), generic = structure("row.names<-", package = "rgeos"), 
         package = "rgeos", group = list(), valueClass = character(0), signature = c("x", 
         "value"), default = NULL, skeleton = (function (x, value) 
         stop("invalid call in method dispatch to 'row.names<-' (no default method)", 
             domain = NA))(x, value)), <environment>)
  16: stop(gettextf("unable to find an inherited method for function %s for signature %s", 
         sQuote(fdef@generic), sQuote(cnames)), domain = NA)
  
  ── 3. Error: Clean - 'bowtie' polygons with holes (@test_Clean.R#80)  ──────────
  unable to find an inherited method for function 'row.names<-' for signature '"SpatialPolygons", "character"'
  1: clgeo_Clean(sp) at testthat/test_Clean.R:80
  2: applyHandler(1:length(sp), function(x) {
         polygon <- slot(sp, "polygons")[[x]]
         ID <- slot(polygon, "ID")
         if (!all(is.na(nv))) {
             if (x %in% nv) {
                 polygons <- slot(polygon, "Polygons")
                 poly.nb <- length(polygons)
                 removedHoles <- vector()
                 if (poly.nb > 0) {
                     newpolygons <- list()
                     for (i in 1:poly.nb) {
                       if (slot(polygons[[i]], "hole")) {
                         if (dim(unique(slot(polygons[[i]], "coords")))[1] < 3) {
                           if (length(removedHoles) == 0 & verbose) {
                             logger.info(sprintf("Cleaning orphaned holes at index %s", 
                               x))
                           }
                           removedHoles <- c(removedHoles, i)
                         }
                         else {
                           newpolygon <- polygons[[i]]
                           slot(newpolygon, "hole") <- TRUE
                           newpolygons <- c(newpolygons, newpolygon)
                         }
                       }
                       else {
                         newpolygon <- polygons[[i]]
                         slot(newpolygon, "hole") <- FALSE
                         newpolygons <- c(newpolygons, newpolygon)
                       }
                     }
                     slot(polygon, "Polygons") <- newpolygons
                 }
                 polygon <- SpatialPolygons(Srl = list(polygon))
                 isValid <- report[x, ]$valid
                 if (length(removedHoles) > 0) {
                     if (verbose) {
                       logger.info(sprintf("Checking geometry validity at index %s", x))
                     }
                     tryCatch({
                       slot(polygon, "polygons") <<- lapply(slot(polygon, "polygons"), 
                         checkPolygonsHoles)
                     }, warning = function(msg) {
                       if (verbose) 
                         logger.info(sprintf("Catched MAPTOOLS warning '%s'", msg))
                     }, error = function(err) {
                       if (verbose) 
                         logger.info(sprintf("Catched MAPTOOLS error '%s'", err))
                     })
                     isValid <<- clgeo_IsValid(polygon, verbose)
                 }
                 if (is.null(errors.only) & !isValid) {
                     if (verbose) {
                       report.msg <- NULL
                       if (!is.na(report[x, "error_msg"])) {
                         report.msg <- report[x, "error_msg"]
                       }
                       else if (!is.na(report[x, "warning_msg"])) {
                         report.msg <- report[x, "warning_msg"]
                       }
                       logger.info(sprintf("Cleaning geometry at index %s (%s)", x, report.msg))
                     }
                     if (strategy == "POLYGONATION") {
                       polygon <- clgeo_CleanByPolygonation.SpatialPolygons(polygon, verbose)
                     }
                     else if (strategy == "BUFFER") {
                       attempt <- 1
                       polygon <- gBuffer(polygon, id = ID, width = 0)
                       while (attempt < 3) {
                         if (!clgeo_IsValid(polygon, verbose)) {
                           attempt <- attempt + 1
                           polygon <- gBuffer(polygon, id = ID, width = 0)
                         }
                         else {
                           break
                         }
                       }
                     }
                 }
                 if (!is.null(polygon)) {
                     polygon <- polygon@polygons[[1]]
                     slot(polygon, "ID") <- ID
                 }
                 else {
                     if (verbose) {
                       logger.info(sprintf("Removing false polygon at index %s", x))
                     }
                 }
             }
         }
         return(polygon)
     })
  3: lapply(X, FUN, ...)
  4: FUN(X[[i]], ...)
  5: clgeo_CleanByPolygonation.SpatialPolygons(polygon, verbose)
  6: unlist(lapply(sp@polygons, clgeo_CleanByPolygonation.Polygons, verbose))
  7: lapply(sp@polygons, clgeo_CleanByPolygonation.Polygons, verbose)
  8: FUN(X[[i]], ...)
  9: gUnionCascaded(trsp, sapply(trsp@polygons, slot, "ID"))
  10: TopologyFunc(groupID(spgeom[ids[[i]]], id[ids[[i]]]), names(ids)[i], TRUE, "rgeos_unioncascaded")
  11: unique(row.names(spgeom))
  12: row.names(spgeom)
  13: groupID(spgeom[ids[[i]]], id[ids[[i]]])
  14: `row.names<-`(`*tmp*`, value = ids)
  15: (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("SpatialPolygons", package = "sp"), "character"), new("standardGeneric", 
         .Data = function (x, value) 
         standardGeneric("row.names<-"), generic = structure("row.names<-", package = "rgeos"), 
         package = "rgeos", group = list(), valueClass = character(0), signature = c("x", 
         "value"), default = NULL, skeleton = (function (x, value) 
         stop("invalid call in method dispatch to 'row.names<-' (no default method)", 
             domain = NA))(x, value)), <environment>)
  16: stop(gettextf("unable to find an inherited method for function %s for signature %s", 
         sQuote(fdef@generic), sQuote(cnames)), domain = NA)
  
  ── 4. Error: Clean - Inner ring with one edge sharing part of an edge of the out
  unable to find an inherited method for function 'row.names<-' for signature '"SpatialPolygons", "character"'
  1: clgeo_Clean(sp) at testthat/test_Clean.R:117
  2: applyHandler(1:length(sp), function(x) {
         polygon <- slot(sp, "polygons")[[x]]
         ID <- slot(polygon, "ID")
         if (!all(is.na(nv))) {
             if (x %in% nv) {
                 polygons <- slot(polygon, "Polygons")
                 poly.nb <- length(polygons)
                 removedHoles <- vector()
                 if (poly.nb > 0) {
                     newpolygons <- list()
                     for (i in 1:poly.nb) {
                       if (slot(polygons[[i]], "hole")) {
                         if (dim(unique(slot(polygons[[i]], "coords")))[1] < 3) {
                           if (length(removedHoles) == 0 & verbose) {
                             logger.info(sprintf("Cleaning orphaned holes at index %s", 
                               x))
                           }
                           removedHoles <- c(removedHoles, i)
                         }
                         else {
                           newpolygon <- polygons[[i]]
                           slot(newpolygon, "hole") <- TRUE
                           newpolygons <- c(newpolygons, newpolygon)
                         }
                       }
                       else {
                         newpolygon <- polygons[[i]]
                         slot(newpolygon, "hole") <- FALSE
                         newpolygons <- c(newpolygons, newpolygon)
                       }
                     }
                     slot(polygon, "Polygons") <- newpolygons
                 }
                 polygon <- SpatialPolygons(Srl = list(polygon))
                 isValid <- report[x, ]$valid
                 if (length(removedHoles) > 0) {
                     if (verbose) {
                       logger.info(sprintf("Checking geometry validity at index %s", x))
                     }
                     tryCatch({
                       slot(polygon, "polygons") <<- lapply(slot(polygon, "polygons"), 
                         checkPolygonsHoles)
                     }, warning = function(msg) {
                       if (verbose) 
                         logger.info(sprintf("Catched MAPTOOLS warning '%s'", msg))
                     }, error = function(err) {
                       if (verbose) 
                         logger.info(sprintf("Catched MAPTOOLS error '%s'", err))
                     })
                     isValid <<- clgeo_IsValid(polygon, verbose)
                 }
                 if (is.null(errors.only) & !isValid) {
                     if (verbose) {
                       report.msg <- NULL
                       if (!is.na(report[x, "error_msg"])) {
                         report.msg <- report[x, "error_msg"]
                       }
                       else if (!is.na(report[x, "warning_msg"])) {
                         report.msg <- report[x, "warning_msg"]
                       }
                       logger.info(sprintf("Cleaning geometry at index %s (%s)", x, report.msg))
                     }
                     if (strategy == "POLYGONATION") {
                       polygon <- clgeo_CleanByPolygonation.SpatialPolygons(polygon, verbose)
                     }
                     else if (strategy == "BUFFER") {
                       attempt <- 1
                       polygon <- gBuffer(polygon, id = ID, width = 0)
                       while (attempt < 3) {
                         if (!clgeo_IsValid(polygon, verbose)) {
                           attempt <- attempt + 1
                           polygon <- gBuffer(polygon, id = ID, width = 0)
                         }
                         else {
                           break
                         }
                       }
                     }
                 }
                 if (!is.null(polygon)) {
                     polygon <- polygon@polygons[[1]]
                     slot(polygon, "ID") <- ID
                 }
                 else {
                     if (verbose) {
                       logger.info(sprintf("Removing false polygon at index %s", x))
                     }
                 }
             }
         }
         return(polygon)
     })
  3: lapply(X, FUN, ...)
  4: FUN(X[[i]], ...)
  5: clgeo_CleanByPolygonation.SpatialPolygons(polygon, verbose)
  6: unlist(lapply(sp@polygons, clgeo_CleanByPolygonation.Polygons, verbose))
  7: lapply(sp@polygons, clgeo_CleanByPolygonation.Polygons, verbose)
  8: FUN(X[[i]], ...)
  9: gUnionCascaded(trsp, sapply(trsp@polygons, slot, "ID"))
  10: TopologyFunc(groupID(spgeom[ids[[i]]], id[ids[[i]]]), names(ids)[i], TRUE, "rgeos_unioncascaded")
  11: unique(row.names(spgeom))
  12: row.names(spgeom)
  13: groupID(spgeom[ids[[i]]], id[ids[[i]]])
  14: `row.names<-`(`*tmp*`, value = ids)
  15: (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("SpatialPolygons", package = "sp"), "character"), new("standardGeneric", 
         .Data = function (x, value) 
         standardGeneric("row.names<-"), generic = structure("row.names<-", package = "rgeos"), 
         package = "rgeos", group = list(), valueClass = character(0), signature = c("x", 
         "value"), default = NULL, skeleton = (function (x, value) 
         stop("invalid call in method dispatch to 'row.names<-' (no default method)", 
             domain = NA))(x, value)), <environment>)
  16: stop(gettextf("unable to find an inherited method for function %s for signature %s", 
         sQuote(fdef@generic), sQuote(cnames)), domain = NA)
  
  ── 5. Error: Clean - Two adjacent inner rings (@test_Clean.R#126)  ─────────────
  unable to find an inherited method for function 'row.names<-' for signature '"SpatialPolygons", "character"'
  1: clgeo_Clean(sp) at testthat/test_Clean.R:126
  2: applyHandler(1:length(sp), function(x) {
         polygon <- slot(sp, "polygons")[[x]]
         ID <- slot(polygon, "ID")
         if (!all(is.na(nv))) {
             if (x %in% nv) {
                 polygons <- slot(polygon, "Polygons")
                 poly.nb <- length(polygons)
                 removedHoles <- vector()
                 if (poly.nb > 0) {
                     newpolygons <- list()
                     for (i in 1:poly.nb) {
                       if (slot(polygons[[i]], "hole")) {
                         if (dim(unique(slot(polygons[[i]], "coords")))[1] < 3) {
                           if (length(removedHoles) == 0 & verbose) {
                             logger.info(sprintf("Cleaning orphaned holes at index %s", 
                               x))
                           }
                           removedHoles <- c(removedHoles, i)
                         }
                         else {
                           newpolygon <- polygons[[i]]
                           slot(newpolygon, "hole") <- TRUE
                           newpolygons <- c(newpolygons, newpolygon)
                         }
                       }
                       else {
                         newpolygon <- polygons[[i]]
                         slot(newpolygon, "hole") <- FALSE
                         newpolygons <- c(newpolygons, newpolygon)
                       }
                     }
                     slot(polygon, "Polygons") <- newpolygons
                 }
                 polygon <- SpatialPolygons(Srl = list(polygon))
                 isValid <- report[x, ]$valid
                 if (length(removedHoles) > 0) {
                     if (verbose) {
                       logger.info(sprintf("Checking geometry validity at index %s", x))
                     }
                     tryCatch({
                       slot(polygon, "polygons") <<- lapply(slot(polygon, "polygons"), 
                         checkPolygonsHoles)
                     }, warning = function(msg) {
                       if (verbose) 
                         logger.info(sprintf("Catched MAPTOOLS warning '%s'", msg))
                     }, error = function(err) {
                       if (verbose) 
                         logger.info(sprintf("Catched MAPTOOLS error '%s'", err))
                     })
                     isValid <<- clgeo_IsValid(polygon, verbose)
                 }
                 if (is.null(errors.only) & !isValid) {
                     if (verbose) {
                       report.msg <- NULL
                       if (!is.na(report[x, "error_msg"])) {
                         report.msg <- report[x, "error_msg"]
                       }
                       else if (!is.na(report[x, "warning_msg"])) {
                         report.msg <- report[x, "warning_msg"]
                       }
                       logger.info(sprintf("Cleaning geometry at index %s (%s)", x, report.msg))
                     }
                     if (strategy == "POLYGONATION") {
                       polygon <- clgeo_CleanByPolygonation.SpatialPolygons(polygon, verbose)
                     }
                     else if (strategy == "BUFFER") {
                       attempt <- 1
                       polygon <- gBuffer(polygon, id = ID, width = 0)
                       while (attempt < 3) {
                         if (!clgeo_IsValid(polygon, verbose)) {
                           attempt <- attempt + 1
                           polygon <- gBuffer(polygon, id = ID, width = 0)
                         }
                         else {
                           break
                         }
                       }
                     }
                 }
                 if (!is.null(polygon)) {
                     polygon <- polygon@polygons[[1]]
                     slot(polygon, "ID") <- ID
                 }
                 else {
                     if (verbose) {
                       logger.info(sprintf("Removing false polygon at index %s", x))
                     }
                 }
             }
         }
         return(polygon)
     })
  3: lapply(X, FUN, ...)
  4: FUN(X[[i]], ...)
  5: clgeo_CleanByPolygonation.SpatialPolygons(polygon, verbose)
  6: unlist(lapply(sp@polygons, clgeo_CleanByPolygonation.Polygons, verbose))
  7: lapply(sp@polygons, clgeo_CleanByPolygonation.Polygons, verbose)
  8: FUN(X[[i]], ...)
  9: gUnionCascaded(trsp, sapply(trsp@polygons, slot, "ID"))
  10: TopologyFunc(groupID(spgeom[ids[[i]]], id[ids[[i]]]), names(ids)[i], TRUE, "rgeos_unioncascaded")
  11: unique(row.names(spgeom))
  12: row.names(spgeom)
  13: groupID(spgeom[ids[[i]]], id[ids[[i]]])
  14: `row.names<-`(`*tmp*`, value = ids)
  15: (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("SpatialPolygons", package = "sp"), "character"), new("standardGeneric", 
         .Data = function (x, value) 
         standardGeneric("row.names<-"), generic = structure("row.names<-", package = "rgeos"), 
         package = "rgeos", group = list(), valueClass = character(0), signature = c("x", 
         "value"), default = NULL, skeleton = (function (x, value) 
         stop("invalid call in method dispatch to 'row.names<-' (no default method)", 
             domain = NA))(x, value)), <environment>)
  16: stop(gettextf("unable to find an inherited method for function %s for signature %s", 
         sQuote(fdef@generic), sQuote(cnames)), domain = NA)
  
  ── 6. Error: Clean - Nested polygon (@test_Clean.R#135)  ───────────────────────
  unable to find an inherited method for function 'row.names<-' for signature '"SpatialPolygons", "character"'
  1: clgeo_Clean(sp) at testthat/test_Clean.R:135
  2: applyHandler(1:length(sp), function(x) {
         polygon <- slot(sp, "polygons")[[x]]
         ID <- slot(polygon, "ID")
         if (!all(is.na(nv))) {
             if (x %in% nv) {
                 polygons <- slot(polygon, "Polygons")
                 poly.nb <- length(polygons)
                 removedHoles <- vector()
                 if (poly.nb > 0) {
                     newpolygons <- list()
                     for (i in 1:poly.nb) {
                       if (slot(polygons[[i]], "hole")) {
                         if (dim(unique(slot(polygons[[i]], "coords")))[1] < 3) {
                           if (length(removedHoles) == 0 & verbose) {
                             logger.info(sprintf("Cleaning orphaned holes at index %s", 
                               x))
                           }
                           removedHoles <- c(removedHoles, i)
                         }
                         else {
                           newpolygon <- polygons[[i]]
                           slot(newpolygon, "hole") <- TRUE
                           newpolygons <- c(newpolygons, newpolygon)
                         }
                       }
                       else {
                         newpolygon <- polygons[[i]]
                         slot(newpolygon, "hole") <- FALSE
                         newpolygons <- c(newpolygons, newpolygon)
                       }
                     }
                     slot(polygon, "Polygons") <- newpolygons
                 }
                 polygon <- SpatialPolygons(Srl = list(polygon))
                 isValid <- report[x, ]$valid
                 if (length(removedHoles) > 0) {
                     if (verbose) {
                       logger.info(sprintf("Checking geometry validity at index %s", x))
                     }
                     tryCatch({
                       slot(polygon, "polygons") <<- lapply(slot(polygon, "polygons"), 
                         checkPolygonsHoles)
                     }, warning = function(msg) {
                       if (verbose) 
                         logger.info(sprintf("Catched MAPTOOLS warning '%s'", msg))
                     }, error = function(err) {
                       if (verbose) 
                         logger.info(sprintf("Catched MAPTOOLS error '%s'", err))
                     })
                     isValid <<- clgeo_IsValid(polygon, verbose)
                 }
                 if (is.null(errors.only) & !isValid) {
                     if (verbose) {
                       report.msg <- NULL
                       if (!is.na(report[x, "error_msg"])) {
                         report.msg <- report[x, "error_msg"]
                       }
                       else if (!is.na(report[x, "warning_msg"])) {
                         report.msg <- report[x, "warning_msg"]
                       }
                       logger.info(sprintf("Cleaning geometry at index %s (%s)", x, report.msg))
                     }
                     if (strategy == "POLYGONATION") {
                       polygon <- clgeo_CleanByPolygonation.SpatialPolygons(polygon, verbose)
                     }
                     else if (strategy == "BUFFER") {
                       attempt <- 1
                       polygon <- gBuffer(polygon, id = ID, width = 0)
                       while (attempt < 3) {
                         if (!clgeo_IsValid(polygon, verbose)) {
                           attempt <- attempt + 1
                           polygon <- gBuffer(polygon, id = ID, width = 0)
                         }
                         else {
                           break
                         }
                       }
                     }
                 }
                 if (!is.null(polygon)) {
                     polygon <- polygon@polygons[[1]]
                     slot(polygon, "ID") <- ID
                 }
                 else {
                     if (verbose) {
                       logger.info(sprintf("Removing false polygon at index %s", x))
                     }
                 }
             }
         }
         return(polygon)
     })
  3: lapply(X, FUN, ...)
  4: FUN(X[[i]], ...)
  5: clgeo_CleanByPolygonation.SpatialPolygons(polygon, verbose)
  6: unlist(lapply(sp@polygons, clgeo_CleanByPolygonation.Polygons, verbose))
  7: lapply(sp@polygons, clgeo_CleanByPolygonation.Polygons, verbose)
  8: FUN(X[[i]], ...)
  9: gUnionCascaded(trsp, sapply(trsp@polygons, slot, "ID"))
  10: TopologyFunc(groupID(spgeom[ids[[i]]], id[ids[[i]]]), names(ids)[i], TRUE, "rgeos_unioncascaded")
  11: unique(row.names(spgeom))
  12: row.names(spgeom)
  13: groupID(spgeom[ids[[i]]], id[ids[[i]]])
  14: `row.names<-`(`*tmp*`, value = ids)
  15: (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("SpatialPolygons", package = "sp"), "character"), new("standardGeneric", 
         .Data = function (x, value) 
         standardGeneric("row.names<-"), generic = structure("row.names<-", package = "rgeos"), 
         package = "rgeos", group = list(), valueClass = character(0), signature = c("x", 
         "value"), default = NULL, skeleton = (function (x, value) 
         stop("invalid call in method dispatch to 'row.names<-' (no default method)", 
             domain = NA))(x, value)), <environment>)
  16: stop(gettextf("unable to find an inherited method for function %s for signature %s", 
         sQuote(fdef@generic), sQuote(cnames)), domain = NA)
  
  ── 7. Error: Clean - Nested polygon (@test_Clean.R#145)  ───────────────────────
  unable to find an inherited method for function 'row.names<-' for signature '"SpatialPolygons", "character"'
  1: clgeo_Clean(sp) at testthat/test_Clean.R:145
  2: applyHandler(1:length(sp), function(x) {
         polygon <- slot(sp, "polygons")[[x]]
         ID <- slot(polygon, "ID")
         if (!all(is.na(nv))) {
             if (x %in% nv) {
                 polygons <- slot(polygon, "Polygons")
                 poly.nb <- length(polygons)
                 removedHoles <- vector()
                 if (poly.nb > 0) {
                     newpolygons <- list()
                     for (i in 1:poly.nb) {
                       if (slot(polygons[[i]], "hole")) {
                         if (dim(unique(slot(polygons[[i]], "coords")))[1] < 3) {
                           if (length(removedHoles) == 0 & verbose) {
                             logger.info(sprintf("Cleaning orphaned holes at index %s", 
                               x))
                           }
                           removedHoles <- c(removedHoles, i)
                         }
                         else {
                           newpolygon <- polygons[[i]]
                           slot(newpolygon, "hole") <- TRUE
                           newpolygons <- c(newpolygons, newpolygon)
                         }
                       }
                       else {
                         newpolygon <- polygons[[i]]
                         slot(newpolygon, "hole") <- FALSE
                         newpolygons <- c(newpolygons, newpolygon)
                       }
                     }
                     slot(polygon, "Polygons") <- newpolygons
                 }
                 polygon <- SpatialPolygons(Srl = list(polygon))
                 isValid <- report[x, ]$valid
                 if (length(removedHoles) > 0) {
                     if (verbose) {
                       logger.info(sprintf("Checking geometry validity at index %s", x))
                     }
                     tryCatch({
                       slot(polygon, "polygons") <<- lapply(slot(polygon, "polygons"), 
                         checkPolygonsHoles)
                     }, warning = function(msg) {
                       if (verbose) 
                         logger.info(sprintf("Catched MAPTOOLS warning '%s'", msg))
                     }, error = function(err) {
                       if (verbose) 
                         logger.info(sprintf("Catched MAPTOOLS error '%s'", err))
                     })
                     isValid <<- clgeo_IsValid(polygon, verbose)
                 }
                 if (is.null(errors.only) & !isValid) {
                     if (verbose) {
                       report.msg <- NULL
                       if (!is.na(report[x, "error_msg"])) {
                         report.msg <- report[x, "error_msg"]
                       }
                       else if (!is.na(report[x, "warning_msg"])) {
                         report.msg <- report[x, "warning_msg"]
                       }
                       logger.info(sprintf("Cleaning geometry at index %s (%s)", x, report.msg))
                     }
                     if (strategy == "POLYGONATION") {
                       polygon <- clgeo_CleanByPolygonation.SpatialPolygons(polygon, verbose)
                     }
                     else if (strategy == "BUFFER") {
                       attempt <- 1
                       polygon <- gBuffer(polygon, id = ID, width = 0)
                       while (attempt < 3) {
                         if (!clgeo_IsValid(polygon, verbose)) {
                           attempt <- attempt + 1
                           polygon <- gBuffer(polygon, id = ID, width = 0)
                         }
                         else {
                           break
                         }
                       }
                     }
                 }
                 if (!is.null(polygon)) {
                     polygon <- polygon@polygons[[1]]
                     slot(polygon, "ID") <- ID
                 }
                 else {
                     if (verbose) {
                       logger.info(sprintf("Removing false polygon at index %s", x))
                     }
                 }
             }
         }
         return(polygon)
     })
  3: lapply(X, FUN, ...)
  4: FUN(X[[i]], ...)
  5: clgeo_CleanByPolygonation.SpatialPolygons(polygon, verbose)
  6: unlist(lapply(sp@polygons, clgeo_CleanByPolygonation.Polygons, verbose))
  7: lapply(sp@polygons, clgeo_CleanByPolygonation.Polygons, verbose)
  8: FUN(X[[i]], ...)
  9: gUnionCascaded(trsp, sapply(trsp@polygons, slot, "ID"))
  10: TopologyFunc(groupID(spgeom[ids[[i]]], id[ids[[i]]]), names(ids)[i], TRUE, "rgeos_unioncascaded")
  11: unique(row.names(spgeom))
  12: row.names(spgeom)
  13: groupID(spgeom[ids[[i]]], id[ids[[i]]])
  14: `row.names<-`(`*tmp*`, value = ids)
  15: (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("SpatialPolygons", package = "sp"), "character"), new("standardGeneric", 
         .Data = function (x, value) 
         standardGeneric("row.names<-"), generic = structure("row.names<-", package = "rgeos"), 
         package = "rgeos", group = list(), valueClass = character(0), signature = c("x", 
         "value"), default = NULL, skeleton = (function (x, value) 
         stop("invalid call in method dispatch to 'row.names<-' (no default method)", 
             domain = NA))(x, value)), <environment>)
  16: stop(gettextf("unable to find an inherited method for function %s for signature %s", 
         sQuote(fdef@generic), sQuote(cnames)), domain = NA)
  
  ── 8. Error: Clean - Multiple nested polygon (@test_Clean.R#155)  ──────────────
  unable to find an inherited method for function 'row.names<-' for signature '"SpatialPolygons", "character"'
  1: clgeo_Clean(sp) at testthat/test_Clean.R:155
  2: applyHandler(1:length(sp), function(x) {
         polygon <- slot(sp, "polygons")[[x]]
         ID <- slot(polygon, "ID")
         if (!all(is.na(nv))) {
             if (x %in% nv) {
                 polygons <- slot(polygon, "Polygons")
                 poly.nb <- length(polygons)
                 removedHoles <- vector()
                 if (poly.nb > 0) {
                     newpolygons <- list()
                     for (i in 1:poly.nb) {
                       if (slot(polygons[[i]], "hole")) {
                         if (dim(unique(slot(polygons[[i]], "coords")))[1] < 3) {
                           if (length(removedHoles) == 0 & verbose) {
                             logger.info(sprintf("Cleaning orphaned holes at index %s", 
                               x))
                           }
                           removedHoles <- c(removedHoles, i)
                         }
                         else {
                           newpolygon <- polygons[[i]]
                           slot(newpolygon, "hole") <- TRUE
                           newpolygons <- c(newpolygons, newpolygon)
                         }
                       }
                       else {
                         newpolygon <- polygons[[i]]
                         slot(newpolygon, "hole") <- FALSE
                         newpolygons <- c(newpolygons, newpolygon)
                       }
                     }
                     slot(polygon, "Polygons") <- newpolygons
                 }
                 polygon <- SpatialPolygons(Srl = list(polygon))
                 isValid <- report[x, ]$valid
                 if (length(removedHoles) > 0) {
                     if (verbose) {
                       logger.info(sprintf("Checking geometry validity at index %s", x))
                     }
                     tryCatch({
                       slot(polygon, "polygons") <<- lapply(slot(polygon, "polygons"), 
                         checkPolygonsHoles)
                     }, warning = function(msg) {
                       if (verbose) 
                         logger.info(sprintf("Catched MAPTOOLS warning '%s'", msg))
                     }, error = function(err) {
                       if (verbose) 
                         logger.info(sprintf("Catched MAPTOOLS error '%s'", err))
                     })
                     isValid <<- clgeo_IsValid(polygon, verbose)
                 }
                 if (is.null(errors.only) & !isValid) {
                     if (verbose) {
                       report.msg <- NULL
                       if (!is.na(report[x, "error_msg"])) {
                         report.msg <- report[x, "error_msg"]
                       }
                       else if (!is.na(report[x, "warning_msg"])) {
                         report.msg <- report[x, "warning_msg"]
                       }
                       logger.info(sprintf("Cleaning geometry at index %s (%s)", x, report.msg))
                     }
                     if (strategy == "POLYGONATION") {
                       polygon <- clgeo_CleanByPolygonation.SpatialPolygons(polygon, verbose)
                     }
                     else if (strategy == "BUFFER") {
                       attempt <- 1
                       polygon <- gBuffer(polygon, id = ID, width = 0)
                       while (attempt < 3) {
                         if (!clgeo_IsValid(polygon, verbose)) {
                           attempt <- attempt + 1
                           polygon <- gBuffer(polygon, id = ID, width = 0)
                         }
                         else {
                           break
                         }
                       }
                     }
                 }
                 if (!is.null(polygon)) {
                     polygon <- polygon@polygons[[1]]
                     slot(polygon, "ID") <- ID
                 }
                 else {
                     if (verbose) {
                       logger.info(sprintf("Removing false polygon at index %s", x))
                     }
                 }
             }
         }
         return(polygon)
     })
  3: lapply(X, FUN, ...)
  4: FUN(X[[i]], ...)
  5: clgeo_CleanByPolygonation.SpatialPolygons(polygon, verbose)
  6: unlist(lapply(sp@polygons, clgeo_CleanByPolygonation.Polygons, verbose))
  7: lapply(sp@polygons, clgeo_CleanByPolygonation.Polygons, verbose)
  8: FUN(X[[i]], ...)
  9: gUnionCascaded(trsp, sapply(trsp@polygons, slot, "ID"))
  10: TopologyFunc(groupID(spgeom[ids[[i]]], id[ids[[i]]]), names(ids)[i], TRUE, "rgeos_unioncascaded")
  11: unique(row.names(spgeom))
  12: row.names(spgeom)
  13: groupID(spgeom[ids[[i]]], id[ids[[i]]])
  14: `row.names<-`(`*tmp*`, value = ids)
  15: (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("SpatialPolygons", package = "sp"), "character"), new("standardGeneric", 
         .Data = function (x, value) 
         standardGeneric("row.names<-"), generic = structure("row.names<-", package = "rgeos"), 
         package = "rgeos", group = list(), valueClass = character(0), signature = c("x", 
         "value"), default = NULL, skeleton = (function (x, value) 
         stop("invalid call in method dispatch to 'row.names<-' (no default method)", 
             domain = NA))(x, value)), <environment>)
  16: stop(gettextf("unable to find an inherited method for function %s for signature %s", 
         sQuote(fdef@generic), sQuote(cnames)), domain = NA)
  
  ── 9. Error: Clean - Dangling edge (@test_Clean.R#172)  ────────────────────────
  unable to find an inherited method for function 'row.names<-' for signature '"SpatialPolygons", "character"'
  1: clgeo_Clean(sp) at testthat/test_Clean.R:172
  2: applyHandler(1:length(sp), function(x) {
         polygon <- slot(sp, "polygons")[[x]]
         ID <- slot(polygon, "ID")
         if (!all(is.na(nv))) {
             if (x %in% nv) {
                 polygons <- slot(polygon, "Polygons")
                 poly.nb <- length(polygons)
                 removedHoles <- vector()
                 if (poly.nb > 0) {
                     newpolygons <- list()
                     for (i in 1:poly.nb) {
                       if (slot(polygons[[i]], "hole")) {
                         if (dim(unique(slot(polygons[[i]], "coords")))[1] < 3) {
                           if (length(removedHoles) == 0 & verbose) {
                             logger.info(sprintf("Cleaning orphaned holes at index %s", 
                               x))
                           }
                           removedHoles <- c(removedHoles, i)
                         }
                         else {
                           newpolygon <- polygons[[i]]
                           slot(newpolygon, "hole") <- TRUE
                           newpolygons <- c(newpolygons, newpolygon)
                         }
                       }
                       else {
                         newpolygon <- polygons[[i]]
                         slot(newpolygon, "hole") <- FALSE
                         newpolygons <- c(newpolygons, newpolygon)
                       }
                     }
                     slot(polygon, "Polygons") <- newpolygons
                 }
                 polygon <- SpatialPolygons(Srl = list(polygon))
                 isValid <- report[x, ]$valid
                 if (length(removedHoles) > 0) {
                     if (verbose) {
                       logger.info(sprintf("Checking geometry validity at index %s", x))
                     }
                     tryCatch({
                       slot(polygon, "polygons") <<- lapply(slot(polygon, "polygons"), 
                         checkPolygonsHoles)
                     }, warning = function(msg) {
                       if (verbose) 
                         logger.info(sprintf("Catched MAPTOOLS warning '%s'", msg))
                     }, error = function(err) {
                       if (verbose) 
                         logger.info(sprintf("Catched MAPTOOLS error '%s'", err))
                     })
                     isValid <<- clgeo_IsValid(polygon, verbose)
                 }
                 if (is.null(errors.only) & !isValid) {
                     if (verbose) {
                       report.msg <- NULL
                       if (!is.na(report[x, "error_msg"])) {
                         report.msg <- report[x, "error_msg"]
                       }
                       else if (!is.na(report[x, "warning_msg"])) {
                         report.msg <- report[x, "warning_msg"]
                       }
                       logger.info(sprintf("Cleaning geometry at index %s (%s)", x, report.msg))
                     }
                     if (strategy == "POLYGONATION") {
                       polygon <- clgeo_CleanByPolygonation.SpatialPolygons(polygon, verbose)
                     }
                     else if (strategy == "BUFFER") {
                       attempt <- 1
                       polygon <- gBuffer(polygon, id = ID, width = 0)
                       while (attempt < 3) {
                         if (!clgeo_IsValid(polygon, verbose)) {
                           attempt <- attempt + 1
                           polygon <- gBuffer(polygon, id = ID, width = 0)
                         }
                         else {
                           break
                         }
                       }
                     }
                 }
                 if (!is.null(polygon)) {
                     polygon <- polygon@polygons[[1]]
                     slot(polygon, "ID") <- ID
                 }
                 else {
                     if (verbose) {
                       logger.info(sprintf("Removing false polygon at index %s", x))
                     }
                 }
             }
         }
         return(polygon)
     })
  3: lapply(X, FUN, ...)
  4: FUN(X[[i]], ...)
  5: clgeo_CleanByPolygonation.SpatialPolygons(polygon, verbose)
  6: unlist(lapply(sp@polygons, clgeo_CleanByPolygonation.Polygons, verbose))
  7: lapply(sp@polygons, clgeo_CleanByPolygonation.Polygons, verbose)
  8: FUN(X[[i]], ...)
  9: gUnionCascaded(trsp, sapply(trsp@polygons, slot, "ID"))
  10: TopologyFunc(groupID(spgeom[ids[[i]]], id[ids[[i]]]), names(ids)[i], TRUE, "rgeos_unioncascaded")
  11: unique(row.names(spgeom))
  12: row.names(spgeom)
  13: groupID(spgeom[ids[[i]]], id[ids[[i]]])
  14: `row.names<-`(`*tmp*`, value = ids)
  15: (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("SpatialPolygons", package = "sp"), "character"), new("standardGeneric", 
         .Data = function (x, value) 
         standardGeneric("row.names<-"), generic = structure("row.names<-", package = "rgeos"), 
         package = "rgeos", group = list(), valueClass = character(0), signature = c("x", 
         "value"), default = NULL, skeleton = (function (x, value) 
         stop("invalid call in method dispatch to 'row.names<-' (no default method)", 
             domain = NA))(x, value)), <environment>)
  16: stop(gettextf("unable to find an inherited method for function %s for signature %s", 
         sQuote(fdef@generic), sQuote(cnames)), domain = NA)
  
  ── 10. Error: Clean - false holes - case 1 (@test_Clean.R#180)  ────────────────
  unable to find an inherited method for function 'row.names<-' for signature '"SpatialPolygons", "character"'
  1: clgeo_Clean(sp) at testthat/test_Clean.R:180
  2: applyHandler(1:length(sp), function(x) {
         polygon <- slot(sp, "polygons")[[x]]
         ID <- slot(polygon, "ID")
         if (!all(is.na(nv))) {
             if (x %in% nv) {
                 polygons <- slot(polygon, "Polygons")
                 poly.nb <- length(polygons)
                 removedHoles <- vector()
                 if (poly.nb > 0) {
                     newpolygons <- list()
                     for (i in 1:poly.nb) {
                       if (slot(polygons[[i]], "hole")) {
                         if (dim(unique(slot(polygons[[i]], "coords")))[1] < 3) {
                           if (length(removedHoles) == 0 & verbose) {
                             logger.info(sprintf("Cleaning orphaned holes at index %s", 
                               x))
                           }
                           removedHoles <- c(removedHoles, i)
                         }
                         else {
                           newpolygon <- polygons[[i]]
                           slot(newpolygon, "hole") <- TRUE
                           newpolygons <- c(newpolygons, newpolygon)
                         }
                       }
                       else {
                         newpolygon <- polygons[[i]]
                         slot(newpolygon, "hole") <- FALSE
                         newpolygons <- c(newpolygons, newpolygon)
                       }
                     }
                     slot(polygon, "Polygons") <- newpolygons
                 }
                 polygon <- SpatialPolygons(Srl = list(polygon))
                 isValid <- report[x, ]$valid
                 if (length(removedHoles) > 0) {
                     if (verbose) {
                       logger.info(sprintf("Checking geometry validity at index %s", x))
                     }
                     tryCatch({
                       slot(polygon, "polygons") <<- lapply(slot(polygon, "polygons"), 
                         checkPolygonsHoles)
                     }, warning = function(msg) {
                       if (verbose) 
                         logger.info(sprintf("Catched MAPTOOLS warning '%s'", msg))
                     }, error = function(err) {
                       if (verbose) 
                         logger.info(sprintf("Catched MAPTOOLS error '%s'", err))
                     })
                     isValid <<- clgeo_IsValid(polygon, verbose)
                 }
                 if (is.null(errors.only) & !isValid) {
                     if (verbose) {
                       report.msg <- NULL
                       if (!is.na(report[x, "error_msg"])) {
                         report.msg <- report[x, "error_msg"]
                       }
                       else if (!is.na(report[x, "warning_msg"])) {
                         report.msg <- report[x, "warning_msg"]
                       }
                       logger.info(sprintf("Cleaning geometry at index %s (%s)", x, report.msg))
                     }
                     if (strategy == "POLYGONATION") {
                       polygon <- clgeo_CleanByPolygonation.SpatialPolygons(polygon, verbose)
                     }
                     else if (strategy == "BUFFER") {
                       attempt <- 1
                       polygon <- gBuffer(polygon, id = ID, width = 0)
                       while (attempt < 3) {
                         if (!clgeo_IsValid(polygon, verbose)) {
                           attempt <- attempt + 1
                           polygon <- gBuffer(polygon, id = ID, width = 0)
                         }
                         else {
                           break
                         }
                       }
                     }
                 }
                 if (!is.null(polygon)) {
                     polygon <- polygon@polygons[[1]]
                     slot(polygon, "ID") <- ID
                 }
                 else {
                     if (verbose) {
                       logger.info(sprintf("Removing false polygon at index %s", x))
                     }
                 }
             }
         }
         return(polygon)
     })
  3: lapply(X, FUN, ...)
  4: FUN(X[[i]], ...)
  5: clgeo_CleanByPolygonation.SpatialPolygons(polygon, verbose)
  6: unlist(lapply(sp@polygons, clgeo_CleanByPolygonation.Polygons, verbose))
  7: lapply(sp@polygons, clgeo_CleanByPolygonation.Polygons, verbose)
  8: FUN(X[[i]], ...)
  9: gUnionCascaded(trsp, sapply(trsp@polygons, slot, "ID"))
  10: TopologyFunc(groupID(spgeom[ids[[i]]], id[ids[[i]]]), names(ids)[i], TRUE, "rgeos_unioncascaded")
  11: unique(row.names(spgeom))
  12: row.names(spgeom)
  13: groupID(spgeom[ids[[i]]], id[ids[[i]]])
  14: `row.names<-`(`*tmp*`, value = ids)
  15: (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("SpatialPolygons", package = "sp"), "character"), new("standardGeneric", 
         .Data = function (x, value) 
         standardGeneric("row.names<-"), generic = structure("row.names<-", package = "rgeos"), 
         package = "rgeos", group = list(), valueClass = character(0), signature = c("x", 
         "value"), default = NULL, skeleton = (function (x, value) 
         stop("invalid call in method dispatch to 'row.names<-' (no default method)", 
             domain = NA))(x, value)), <environment>)
  16: stop(gettextf("unable to find an inherited method for function %s for signature %s", 
         sQuote(fdef@generic), sQuote(cnames)), domain = NA)
  
  ── 11. Error: Clean - false holes - case 2 (@test_Clean.R#188)  ────────────────
  unable to find an inherited method for function 'row.names<-' for signature '"SpatialPolygons", "character"'
  1: clgeo_Clean(sp) at testthat/test_Clean.R:188
  2: applyHandler(1:length(sp), function(x) {
         polygon <- slot(sp, "polygons")[[x]]
         ID <- slot(polygon, "ID")
         if (!all(is.na(nv))) {
             if (x %in% nv) {
                 polygons <- slot(polygon, "Polygons")
                 poly.nb <- length(polygons)
                 removedHoles <- vector()
                 if (poly.nb > 0) {
                     newpolygons <- list()
                     for (i in 1:poly.nb) {
                       if (slot(polygons[[i]], "hole")) {
                         if (dim(unique(slot(polygons[[i]], "coords")))[1] < 3) {
                           if (length(removedHoles) == 0 & verbose) {
                             logger.info(sprintf("Cleaning orphaned holes at index %s", 
                               x))
                           }
                           removedHoles <- c(removedHoles, i)
                         }
                         else {
                           newpolygon <- polygons[[i]]
                           slot(newpolygon, "hole") <- TRUE
                           newpolygons <- c(newpolygons, newpolygon)
                         }
                       }
                       else {
                         newpolygon <- polygons[[i]]
                         slot(newpolygon, "hole") <- FALSE
                         newpolygons <- c(newpolygons, newpolygon)
                       }
                     }
                     slot(polygon, "Polygons") <- newpolygons
                 }
                 polygon <- SpatialPolygons(Srl = list(polygon))
                 isValid <- report[x, ]$valid
                 if (length(removedHoles) > 0) {
                     if (verbose) {
                       logger.info(sprintf("Checking geometry validity at index %s", x))
                     }
                     tryCatch({
                       slot(polygon, "polygons") <<- lapply(slot(polygon, "polygons"), 
                         checkPolygonsHoles)
                     }, warning = function(msg) {
                       if (verbose) 
                         logger.info(sprintf("Catched MAPTOOLS warning '%s'", msg))
                     }, error = function(err) {
                       if (verbose) 
                         logger.info(sprintf("Catched MAPTOOLS error '%s'", err))
                     })
                     isValid <<- clgeo_IsValid(polygon, verbose)
                 }
                 if (is.null(errors.only) & !isValid) {
                     if (verbose) {
                       report.msg <- NULL
                       if (!is.na(report[x, "error_msg"])) {
                         report.msg <- report[x, "error_msg"]
                       }
                       else if (!is.na(report[x, "warning_msg"])) {
                         report.msg <- report[x, "warning_msg"]
                       }
                       logger.info(sprintf("Cleaning geometry at index %s (%s)", x, report.msg))
                     }
                     if (strategy == "POLYGONATION") {
                       polygon <- clgeo_CleanByPolygonation.SpatialPolygons(polygon, verbose)
                     }
                     else if (strategy == "BUFFER") {
                       attempt <- 1
                       polygon <- gBuffer(polygon, id = ID, width = 0)
                       while (attempt < 3) {
                         if (!clgeo_IsValid(polygon, verbose)) {
                           attempt <- attempt + 1
                           polygon <- gBuffer(polygon, id = ID, width = 0)
                         }
                         else {
                           break
                         }
                       }
                     }
                 }
                 if (!is.null(polygon)) {
                     polygon <- polygon@polygons[[1]]
                     slot(polygon, "ID") <- ID
                 }
                 else {
                     if (verbose) {
                       logger.info(sprintf("Removing false polygon at index %s", x))
                     }
                 }
             }
         }
         return(polygon)
     })
  3: lapply(X, FUN, ...)
  4: FUN(X[[i]], ...)
  5: clgeo_CleanByPolygonation.SpatialPolygons(polygon, verbose)
  6: unlist(lapply(sp@polygons, clgeo_CleanByPolygonation.Polygons, verbose))
  7: lapply(sp@polygons, clgeo_CleanByPolygonation.Polygons, verbose)
  8: FUN(X[[i]], ...)
  9: gUnionCascaded(trsp, sapply(trsp@polygons, slot, "ID"))
  10: TopologyFunc(groupID(spgeom[ids[[i]]], id[ids[[i]]]), names(ids)[i], TRUE, "rgeos_unioncascaded")
  11: unique(row.names(spgeom))
  12: row.names(spgeom)
  13: groupID(spgeom[ids[[i]]], id[ids[[i]]])
  14: `row.names<-`(`*tmp*`, value = ids)
  15: (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("SpatialPolygons", package = "sp"), "character"), new("standardGeneric", 
         .Data = function (x, value) 
         standardGeneric("row.names<-"), generic = structure("row.names<-", package = "rgeos"), 
         package = "rgeos", group = list(), valueClass = character(0), signature = c("x", 
         "value"), default = NULL, skeleton = (function (x, value) 
         stop("invalid call in method dispatch to 'row.names<-' (no default method)", 
             domain = NA))(x, value)), <environment>)
  16: stop(gettextf("unable to find an inherited method for function %s for signature %s", 
         sQuote(fdef@generic), sQuote(cnames)), domain = NA)
  
  [cleangeo][INFO] Cleaning geometry at index 1 (Too few points in geometry component at or near point 0 0) 
  [cleangeo][INFO] Catched RGEOS warning 'simpleWarning in RGEOSUnaryPredFunc(spgeom, byid, "rgeos_isvalid"): Too few points in geometry component at or near point 0 0
  ' 
  [cleangeo][INFO] Removing false polygon at index 1 
  [cleangeo][INFO] Catched RGEOS warning 'simpleWarning in RGEOSUnaryPredFunc(spgeom, byid, "rgeos_isvalid"): Self-intersection at or near point 5 5
  ' 
  [cleangeo][INFO] Catched RGEOS warning 'simpleWarning in RGEOSUnaryPredFunc(spgeom, byid, "rgeos_isvalid"): Too few points in geometry component at or near point 0 0
  ' 
  ══ testthat results  ═══════════════════════════════════════════════════════════
  OK: 31 SKIPPED: 0 FAILED: 11
  1. Error: clgeo_Clean (@test_Clean.R#49) 
  2. Error: Clean - 'bowtie' polygons (@test_Clean.R#69) 
  3. Error: Clean - 'bowtie' polygons with holes (@test_Clean.R#80) 
  4. Error: Clean - Inner ring with one edge sharing part of an edge of the outer ring (@test_Clean.R#117) 
  5. Error: Clean - Two adjacent inner rings (@test_Clean.R#126) 
  6. Error: Clean - Nested polygon (@test_Clean.R#135) 
  7. Error: Clean - Nested polygon (@test_Clean.R#145) 
  8. Error: Clean - Multiple nested polygon (@test_Clean.R#155) 
  9. Error: Clean - Dangling edge (@test_Clean.R#172) 
  1. ...
  
  Error: testthat unit tests failed
  Execution halted