Running 'agg.R' [1s]
  Comparing 'agg.Rout' to 'agg.Rout.save' ... OK
  Running 'base.R' [1s]
  Comparing 'base.Rout' to 'base.Rout.save' ... OK
  Running 'fail1.R' [153s]
  Running 'grid.R' [1s]
  Comparing 'grid.Rout' to 'grid.Rout.save' ... OK
  Running 'over2.R' [1s]
  Comparing 'over2.Rout' to 'over2.Rout.save' ... OK
  Running 'pass1.R' [2s]
  Comparing 'pass1.Rout' to 'pass1.Rout.save' ... OK
  Running 'point.in.polygon.R' [0s]
  Comparing 'point.in.polygon.Rout' to 'point.in.polygon.Rout.save' ... OK
  Running 'sel.R' [1s]
  Comparing 'sel.Rout' to 'sel.Rout.save' ... OK
  Running 'sp1.R' [1s]
  Comparing 'sp1.Rout' to 'sp1.Rout.save' ... OK
  Running 'spDists.R' [2s]
  Comparing 'spDists.Rout' to 'spDists.Rout.save' ... OK
  Running 'spplot.R' [1s]
  Comparing 'spplot.Rout' to 'spplot.Rout.save' ... OK
  Running 'zerodist.R' [146s]
Running the tests in 'tests/fail1.R' failed.
Complete output:
  > options("rgdal_show_exportToProj4_warnings"="none")
  > library(sp)
  > data(meuse)
  > x = meuse
  > 
  > coordinates(x) <- c("x", "y")
  > try(proj4string(x) <- 1.5)
  Error : unable to find an inherited method for function 'proj4string<-' for signature 'obj = "SpatialPointsDataFrame", value = "numeric"'
  > try(coordinates(a) <- cbind(1:10, 10:1))
  Error : object 'a' not found
  > # fails because a is not found; passes if a assigned NULL, see pass1.R
  > 
  > x = meuse
  > # invalid coordinate formulae:
  > try(coordinates(x) <- ~log(x)+sqrt(y)) # no expressions allowed
  Error in `[.data.frame`(object, , -coord.numbers, drop = FALSE) : 
    undefined columns selected
  > try(coordinates(x) <- ~x+y+z) # z is not present
  Error in eval(predvars, data, env) : object 'z' not found
  > x$x2 = x$x^2
  > x$y2 = x$y^2
  > try(coordinates(x) <- ~x+y+x2+y2) # 4D now passes check...
  > x = meuse
  > try(coordinates(x) <- ~x) # 1D not allowed
  Error in validObject(.Object) : 
    invalid class "SpatialPoints" object: spatial.dimension should be 2 or more
  > 
  > # is.na.sp.coords
  > a = data.frame(cbind(xx=c(1,NA,2,10),yy=c(2,NA,NA,20)))
  > try(coordinates(a) <- c("xx", "yy")) # should fail!
  Error in `coordinates<-`(`*tmp*`, value = c("xx", "yy")) : 
    coordinates are not allowed to contain missing values
  > 
  > x = meuse[1:4,]
  > coordinates(x) = c(1,2)
  > # this should fail -- zinc is not a row:
  > #(and will break automatic testing, so outcommented!)
  > #try(q <- x["zinc",])
  > # this will issue warning under S-Plus, or a silent rename under R
  > try(x[c("zinc", "copper", "zinc")])
         coordinates zinc copper zinc.1
  1 (181072, 333611) 1022     85   1022
  2 (181025, 333558) 1141     81   1141
  3 (181165, 333537)  640     68    640
  4 (181298, 333484)  257     81    257
  > 
  > # this will fail, as "x" is not in the data part:
  > try(x[c("zinc", "x", "copper", "zinc")])
  Error in `[.data.frame`(x@data, i, j, ..., drop = FALSE) : 
    undefined columns selected
  > 
  > # row index containing missing values will fail:
  > try(xx <- x[c(1:3,NA),])
  Error in x[c(1:3, NA), ] : NAs not permitted in row index
  > 
  > xx = data.frame(x=1:10, y=1:10)
  > 
  > # fails; use SpatialPoints() to create points without attribute 
  > try(coordinates(xx) <- c("x", "y")) 
  > 
  > x = matrix(3, 5, 2)
  > dimnames(x) = list(c(1,1:4), NULL)
  > y = data.frame(a = 1:5, b = 5:1)
  > try(SpatialPointsDataFrame(x, y)) # will complain:
  Error in SpatialPointsDataFrame(x, y) : 
    row.names of data and dimnames of coords do not match
  In addition: Warning message:
  In SpatialPointsDataFrame(x, y) :
    forming a SpatialPointsDataFrame based on maching IDs, not on record order. Use match.ID = FALSE to match on record order
  > SpatialPointsDataFrame(x, y, match.ID = FALSE) # won't complain
    coordinates a b
  1      (3, 3) 1 5
  2      (3, 3) 2 4
  3      (3, 3) 3 3
  4      (3, 3) 4 2
  5      (3, 3) 5 1
  Warning messages:
  1: In validityMethod(object) :
    duplicate rownames are interpreted by rgeos as MultiPoints; use SpatialMultiPoints to define these; in future sp versions this warning will become an error
  2: In validityMethod(as(object, superClass)) :
    duplicate rownames are interpreted by rgeos as MultiPoints; use SpatialMultiPoints to define these; in future sp versions this warning will become an error
  > 
  > Sr1 = Polygon(cbind(c(2,4,4,1,2),c(2,3,5,4,2)))
  > Sr2 = Polygon(cbind(c(5,4,2,5),c(2,3,2,2)))
  > Sr3 = Polygon(cbind(c(4,4,5,10,4),c(5,3,2,5,5)))
  > Sr4 = Polygon(cbind(c(5,6,6,5,5),c(4,4,3,3,4)), hole = TRUE)
  > 
  > Srs1 = Polygons(list(Sr1), "s1")
  > Srs2 = Polygons(list(Sr2), "s2")
  > Srs3 = Polygons(list(Sr3, Sr4), "s2")
  > try(SR <- SpatialPolygons(list(Srs1,Srs2,Srs3))) # will complain
  Error in validObject(res) : 
    invalid class "SpatialPolygons" object: non-unique Polygons ID slot values
  > Srs3 = Polygons(list(Sr3, Sr4), "s3/4")
  > SR = SpatialPolygons(list(Srs1,Srs2,Srs3)) # won't complain
  > try(SRx <- SR[c(1,2,NA),])
  Error in SR[c(1, 2, NA), ] : NAs not permitted in row index
  > 
  > attr = data.frame(a=1:3, b=3:1, row.names=c("s1", "s2", "s3"))
  > try(SrDf <- SpatialPolygonsDataFrame(SR, attr)) # will complain
  Error in SpatialPolygonsDataFrame(SR, attr) : 
    row.names of data and Polygons IDs do not match
  > SrDf = SpatialPolygonsDataFrame(SR, attr, match.ID = FALSE) # won't complain
  > attr = data.frame(a=1:3, b=3:1, row.names=c("s1", "s2", "s3/4"))
  > SrDf = SpatialPolygonsDataFrame(SR, attr) # won't complain
  > 
  > l1 = cbind(c(1,2,3),c(3,2,2))
  > l1a = cbind(l1[,1]+.05,l1[,2]+.05)
  > l2 = cbind(c(1,2,3),c(1,1.5,1))
  > Sl1 = Line(l1)
  > Sl1a = Line(l1a)
  > Sl2 = Line(l2)
  > S1 = Lines(list(Sl1, Sl1a), ID="a")
  > S2 = Lines(list(Sl2), ID="b")
  > S3 = Lines(list(Sl2), ID="a")
  > Sl = SpatialLines(list(S1,S2)) # won't complain
  > try(Sl1 <- SpatialLines(list(S1,S3))) # will complain
  Error in validObject(.Object) : 
    invalid class "SpatialLines" object: non-unique Lines ID slot values
  > try(Sl1 <- Sl[c(NA,2),]) # will fail
  Error in Sl[c(NA, 2), ] : NAs not permitted in row index
  > 
  > df = data.frame(z = c(1,2), row.names=sapply(slot(Sl, "lines"), function(x) slot(x, "ID")))
  > Sldf = SpatialLinesDataFrame(Sl, data = df) # won't complain
  > df1 = data.frame(z = c(1,2))
  > try(Sldf1 <- SpatialLinesDataFrame(Sl, data = df1)) # will complain
  Error in SpatialLinesDataFrame(Sl, data = df1) : 
    row.names of data and Lines IDs do not match
  > Sldf1 = SpatialLinesDataFrame(Sl, data = df1, match.ID = FALSE) # won't complain
  > try(Sldf1 <- Sldf1[c(1,NA),])
  Error in Sldf1[c(1, NA), ] : NAs not permitted in row index
  > 
  > data(meuse.grid)
  > gridded(meuse.grid) = ~x+y
  > try(x <- meuse.grid[c(1:10,NA,12),])
  Error in meuse.grid[c(1:10, NA, 12), ] : NAs not permitted in row index
  > fullgrid(meuse.grid) = TRUE
  > try(x <- meuse.grid[c(1:10,NA,12),])
  Error in meuse.grid[c(1:10, NA, 12), ] : NAs not permitted in index
  > 
  > try(x <- meuse[[c("zinc", "cadmium")]])
  Error in .subset2(x, i, exact = exact) : subscript out of bounds
  > try(meuse[[c("zn", "cd")]] <- cbind(meuse$zinc, meuse$cadmium))
  Error in `[[<-`(`*tmp*`, i, value = value) : no such index at level 1
  
  > 
  > data(meuse.grid)
  > coordinates(meuse.grid) <- c("x", "y")
  > gridded(meuse.grid) <- TRUE
  > gridparameters(meuse.grid)
    cellcentre.offset cellsize cells.dim
  x            178460       40        78
  y            329620       40       104
  > 
  > image(meuse.grid)
  > image(meuse.grid[2])
  > image(meuse.grid, 2)
  > try(image(meuse.grid, 0))
  Error in .subset2(x, i, exact = exact) : subscript out of bounds
  > image(meuse.grid[3], breaks=c(0,.2,.5,.8,1), col = bpy.colors(4))
  > image(meuse.grid, 3, zlim = c(0,.3))
  > image(meuse.grid, 3, zlim = c(.3,.1))
  > image(meuse.grid, 3, zlim = c(.2,.8))
  > image(meuse.grid, 3, zlim = c(.2,.8), breaks = c(.2,.4,.6,.8), 
  + 	col = bpy.colors(3))
  > 
  > data(meuse.grid)
  > set.seed(1)
  > meuse.grid$x <- meuse.grid$x + rnorm(length(meuse.grid$x), 0, 0.0002)
  > meuse.grid$y <- meuse.grid$y + rnorm(length(meuse.grid$y), 0, 0.0002)
  > coordinates(meuse.grid) <- c("x", "y")
  > try(gridded(meuse.grid) <- TRUE)
  suggested tolerance minimum: 0.964318 
  Error in points2grid(points, tolerance, round) : 
    dimension 1 : coordinate intervals are not constant
  > try(meuse.grid <- SpatialPixelsDataFrame(as(meuse.grid, "SpatialPoints"),
  +   data=as(meuse.grid, "data.frame"), tolerance=0.077))
  > gridparameters(meuse.grid)
    cellcentre.offset cellsize cells.dim
  x            178460 39.99912        78
  y            329620 39.99920       104
  > 
  > data(meuse.grid_ll)
  > try(gridded(meuse.grid_ll) <- TRUE)
  suggested tolerance minimum: 0.818323 
  Error in points2grid(points, tolerance, round) : 
    dimension 1 : coordinate intervals are not constant
  > try(meuse.grid_ll <- SpatialPixelsDataFrame(as(meuse.grid_ll, "SpatialPoints"), data=as(meuse.grid_ll, "data.frame"), tolerance=0.9))
  > gridparameters(meuse.grid_ll)
    cellcentre.offset     cellsize cells.dim
  x          5.721109 0.0005312853        84
  y         50.955770 0.0003318105       112
  > 
  > try(CRS("+proj=latlon +ellps=WGS84"))
  Coordinate Reference System:
  Deprecated Proj.4 representation: +proj=longlat +ellps=WGS84 +no_defs 
  WKT2 2019 representation:
  GEOGCRS["unknown",
      DATUM["Unknown based on WGS 84 ellipsoid",
          ELLIPSOID["WGS 84",6378137,298.257223563,
              LENGTHUNIT["metre",1],
              ID["EPSG",7030]]],
      PRIMEM["Greenwich",0,
          ANGLEUNIT["degree",0.0174532925199433],
          ID["EPSG",8901]],
      CS[ellipsoidal,2],
          AXIS["longitude",east,
              ORDER[1],
              ANGLEUNIT["degree",0.0174532925199433,
                  ID["EPSG",9122]]],
          AXIS["latitude",north,
              ORDER[2],
              ANGLEUNIT["degree",0.0174532925199433,
                  ID["EPSG",9122]]]] 
  > try(CRS("+proj=lonlat +ellps=WGS84"))
  Coordinate Reference System:
  Deprecated Proj.4 representation: +proj=longlat +ellps=WGS84 +no_defs 
  WKT2 2019 representation:
  GEOGCRS["unknown",
      DATUM["Unknown based on WGS 84 ellipsoid",
          ELLIPSOID["WGS 84",6378137,298.257223563,
              LENGTHUNIT["metre",1],
              ID["EPSG",7030]]],
      PRIMEM["Greenwich",0,
          ANGLEUNIT["degree",0.0174532925199433],
          ID["EPSG",8901]],
      CS[ellipsoidal,2],
          AXIS["longitude",east,
              ORDER[1],
              ANGLEUNIT["degree",0.0174532925199433,
                  ID["EPSG",9122]]],
          AXIS["latitude",north,
              ORDER[2],
              ANGLEUNIT["degree",0.0174532925199433,
                  ID["EPSG",9122]]]] 
  > 
  > proc.time()
     user  system elapsed 
     1.37    0.20    1.56 
Running the tests in 'tests/zerodist.R' failed.
Complete output:
  > options("rgdal_show_exportToProj4_warnings"="none")
  > library(sp)
  > data(meuse)
  > # pick 10 rows
  > n = 10
  > set.seed(1357) # fix seed for exact reproduction of test:
  > ran10 = sample(nrow(meuse), size = n, replace = FALSE)
  > meusedup = rbind(meuse, meuse[ran10, ])
  > coordinates(meusedup) = c("x", "y")
  > zd = zerodist(meusedup)
  > sum(abs(sort(zd[,1]) - sort(ran10))) # 0!
  [1] 0
  > zerodist(meusedup, unique.ID = TRUE)
    [1]   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18
   [19]  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36
   [37]  37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53  54
   [55]  55  56  57  58  59  60  61  62  63  64  65  66  67  68  69  70  71  72
   [73]  73  74  75  76  77  78  79  80  81  82  83  84  85  86  87  88  89  90
   [91]  91  92  93  94  95  96  97  98  99 100 101 102 103 104 105 106 107 108
  [109] 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
  [127] 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
  [145] 145 146 147 148 149 150 151 152 153 154 155 140   9  26   7  90  17 133
  [163]  82  35 116
  > # remove the duplicate rows:
  > meusedup2 = meusedup[-zd[,2], ]
  > print(summary(meusedup2))
  Object of class SpatialPointsDataFrame
  Coordinates:
       min    max
  x 178605 181390
  y 329714 333611
  Is projected: NA 
  proj4string : [NA]
  Number of points: 155
  Data attributes:
      cadmium           copper            lead            zinc       
   Min.   : 0.200   Min.   : 14.00   Min.   : 37.0   Min.   : 113.0  
   1st Qu.: 0.800   1st Qu.: 23.00   1st Qu.: 72.5   1st Qu.: 198.0  
   Median : 2.100   Median : 31.00   Median :123.0   Median : 326.0  
   Mean   : 3.246   Mean   : 40.32   Mean   :153.4   Mean   : 469.7  
   3rd Qu.: 3.850   3rd Qu.: 49.50   3rd Qu.:207.0   3rd Qu.: 674.5  
   Max.   :18.100   Max.   :128.00   Max.   :654.0   Max.   :1839.0  
                                                                     
        elev             dist               om         ffreq  soil   lime   
   Min.   : 5.180   Min.   :0.00000   Min.   : 1.000   1:84   1:97   0:111  
   1st Qu.: 7.546   1st Qu.:0.07569   1st Qu.: 5.300   2:48   2:46   1: 44  
   Median : 8.180   Median :0.21184   Median : 6.900   3:23   3:12          
   Mean   : 8.165   Mean   :0.24002   Mean   : 7.478                        
   3rd Qu.: 8.955   3rd Qu.:0.36407   3rd Qu.: 9.000                        
   Max.   :10.520   Max.   :0.88039   Max.   :17.000                        
                                      NA's   :2                             
      landuse       dist.m      
   W      :50   Min.   :  10.0  
   Ah     :39   1st Qu.:  80.0  
   Am     :22   Median : 270.0  
   Fw     :10   Mean   : 290.3  
   Ab     : 8   3rd Qu.: 450.0  
   (Other):25   Max.   :1000.0  
   NA's   : 1                   
  > meusedup3 <- subset(meusedup, !(1:nrow(meusedup) %in% zd[,2]))
  > print(summary(meusedup3))
  Object of class SpatialPointsDataFrame
  Coordinates:
       min    max
  x 178605 181390
  y 329714 333611
  Is projected: NA 
  proj4string : [NA]
  Number of points: 155
  Data attributes:
      cadmium           copper            lead            zinc       
   Min.   : 0.200   Min.   : 14.00   Min.   : 37.0   Min.   : 113.0  
   1st Qu.: 0.800   1st Qu.: 23.00   1st Qu.: 72.5   1st Qu.: 198.0  
   Median : 2.100   Median : 31.00   Median :123.0   Median : 326.0  
   Mean   : 3.246   Mean   : 40.32   Mean   :153.4   Mean   : 469.7  
   3rd Qu.: 3.850   3rd Qu.: 49.50   3rd Qu.:207.0   3rd Qu.: 674.5  
   Max.   :18.100   Max.   :128.00   Max.   :654.0   Max.   :1839.0  
                                                                     
        elev             dist               om         ffreq  soil   lime   
   Min.   : 5.180   Min.   :0.00000   Min.   : 1.000   1:84   1:97   0:111  
   1st Qu.: 7.546   1st Qu.:0.07569   1st Qu.: 5.300   2:48   2:46   1: 44  
   Median : 8.180   Median :0.21184   Median : 6.900   3:23   3:12          
   Mean   : 8.165   Mean   :0.24002   Mean   : 7.478                        
   3rd Qu.: 8.955   3rd Qu.:0.36407   3rd Qu.: 9.000                        
   Max.   :10.520   Max.   :0.88039   Max.   :17.000                        
                                      NA's   :2                             
      landuse       dist.m      
   W      :50   Min.   :  10.0  
   Ah     :39   1st Qu.:  80.0  
   Am     :22   Median : 270.0  
   Fw     :10   Mean   : 290.3  
   Ab     : 8   3rd Qu.: 450.0  
   (Other):25   Max.   :1000.0  
   NA's   : 1                   
  > dim(meuse)
  [1] 155  14
  > dim(meusedup2)
  [1] 155  12
  > dim(meusedup3)
  [1] 155  12
  > dim(remove.duplicates(meusedup))
  [1] 155  12
  > 
  > proc.time()
     user  system elapsed 
     0.78    0.21    1.00