Skip to content

Commit e81f2d3

Browse files
committed
Merge branch 'main' of github.com:edzer/sp
2 parents f956545 + 6452699 commit e81f2d3

File tree

10 files changed

+67
-39
lines changed

10 files changed

+67
-39
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![cran checks](https://badges.cranchecks.info/worst/sp.svg)](https://cran.r-project.org/web/checks/check_results_sp.html)
55
[![Downloads](http://cranlogs.r-pkg.org/badges/sp?color=brightgreen)](http://www.r-pkg.org/pkg/sp)
66

7-
R Classes and Methods for Spatial Data. Note that this is package will (slowly) be deprecated, in favor of package `sf`. It is in maintenance mode, and currently requires `sf` for coordinate reference system validation and coordinate transformation, conversion and (re)projection.
7+
R Classes and Methods for Spatial Data. Note that this package will (slowly) be deprecated, in favor of package `sf`. It is in maintenance mode, and currently requires `sf` for coordinate reference system validation and coordinate transformation, conversion and (re)projection.
88

99
From version 2.2-0, `sp` has dropped the export of a compiled C API formerly used by `rgdal` and `rgeos`
1010

tests/base.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
options("rgdal_show_exportToProj4_warnings"="none")
2+
source("utils/print.R")
3+
24
library(sp)
35
data(meuse)
46
x = meuse[1:10, ] # limit the output

tests/base.Rout.save

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

2-
R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
3-
Copyright (C) 2023 The R Foundation for Statistical Computing
4-
Platform: x86_64-pc-linux-gnu (64-bit)
2+
R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble"
3+
Copyright (C) 2025 The R Foundation for Statistical Computing
4+
Platform: x86_64-pc-linux-gnu
55

66
R is free software and comes with ABSOLUTELY NO WARRANTY.
77
You are welcome to redistribute it under certain conditions.
@@ -16,6 +16,8 @@ Type 'demo()' for some demos, 'help()' for on-line help, or
1616
Type 'q()' to quit R.
1717

1818
> options("rgdal_show_exportToProj4_warnings"="none")
19+
> source("utils/print.R")
20+
>
1921
> library(sp)
2022
> data(meuse)
2123
> x = meuse[1:10, ] # limit the output
@@ -191,7 +193,7 @@ Data attributes:
191193
Ga :2 Mean :174.5
192194
Ag :1 3rd Qu.:277.5
193195
(Other):1 Max. :470.0
194-
NA's :1
196+
NAs :1
195197
>
196198
> x[1:10] # first 10 columns
197199
coordinates cadmium copper lead zinc elev dist om ffreq soil
@@ -460,4 +462,4 @@ Data attributes:
460462
>
461463
> proc.time()
462464
user system elapsed
463-
0.691 0.045 0.730
465+
0.322 0.052 0.365

tests/pass1.R

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
options("rgdal_show_exportToProj4_warnings"="none")
2+
source("utils/print.R")
3+
24
library(sp)
35
data(meuse)
46
x = meuse
@@ -61,9 +63,9 @@ SlDf = SpatialLinesDataFrame(Sl, data.frame(xx = c("foo", "bar")), match.ID = FA
6163
summary(as(SlDf, "SpatialPointsDataFrame"))
6264

6365
meuse[["xxx"]] = log(meuse$zinc)
64-
summary(meuse)
66+
print(summary(meuse))
6567
meuse$xxy = log(meuse[["zinc"]])
66-
summary(meuse)
68+
print(summary(meuse))
6769

6870
# test behaviour on zero-length objects:
6971
demo(meuse, ask = FALSE, echo = FALSE)
@@ -81,11 +83,11 @@ dim(subset(meuse, F, 0))
8183
dim(meuse.grid[0,])
8284
fullgrid(meuse.grid) = TRUE
8385
dim(meuse.grid[0,])
84-
summary(meuse.grid[0,])
86+
print(summary(meuse.grid[0,]))
8587
dim(meuse.grid[,0])
86-
summary(meuse.grid[,0])
88+
print(summary(meuse.grid[,0]))
8789
dim(meuse.grid[0,,0])
88-
summary(meuse.grid[0,,0])
90+
print(summary(meuse.grid[0,,0]))
8991

9092
# SpatialPolygons:
9193
L = as(meuse.riv, "SpatialPolygons")

tests/pass1.Rout.save

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

2-
R version 4.3.2 (2023-10-31) -- "Eye Holes"
3-
Copyright (C) 2023 The R Foundation for Statistical Computing
4-
Platform: x86_64-pc-linux-gnu (64-bit)
2+
R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble"
3+
Copyright (C) 2025 The R Foundation for Statistical Computing
4+
Platform: x86_64-pc-linux-gnu
55

66
R is free software and comes with ABSOLUTELY NO WARRANTY.
77
You are welcome to redistribute it under certain conditions.
@@ -16,6 +16,8 @@ Type 'demo()' for some demos, 'help()' for on-line help, or
1616
Type 'q()' to quit R.
1717

1818
> options("rgdal_show_exportToProj4_warnings"="none")
19+
> source("utils/print.R")
20+
>
1921
> library(sp)
2022
> data(meuse)
2123
> x = meuse
@@ -70,7 +72,7 @@ Data attributes:
7072
Mean : 7.478 Fw :10 Mean : 469.7
7173
3rd Qu.: 9.000 Ab : 8 3rd Qu.: 674.5
7274
Max. :17.000 (Other):25 Max. :1839.0
73-
NA's :2 NA's : 1
75+
NAs :2 NAs : 1
7476
dist copper cadmium soil dist.m
7577
Min. :0.00000 Min. : 14.00 Min. : 0.200 1:97 Min. : 10.0
7678
1st Qu.:0.07569 1st Qu.: 23.00 1st Qu.: 0.800 2:46 1st Qu.: 80.0
@@ -215,7 +217,7 @@ Data attributes:
215217
Max. :2.000 Max. :2.000
216218
>
217219
> meuse[["xxx"]] = log(meuse$zinc)
218-
> summary(meuse)
220+
> print(summary(meuse))
219221
x y cadmium copper
220222
Min. :178605 Min. :329714 Min. : 0.200 Min. : 14.00
221223
1st Qu.:179371 1st Qu.:330762 1st Qu.: 0.800 1st Qu.: 23.00
@@ -239,7 +241,7 @@ Data attributes:
239241
Mean : 7.478 Fw :10 Mean : 290.3
240242
3rd Qu.: 9.000 Ab : 8 3rd Qu.: 450.0
241243
Max. :17.000 (Other):25 Max. :1000.0
242-
NA's :2 NA's : 1
244+
NAs :2 NAs : 1
243245
xxx
244246
Min. :4.727
245247
1st Qu.:5.288
@@ -249,7 +251,7 @@ Data attributes:
249251
Max. :7.517
250252

251253
> meuse$xxy = log(meuse[["zinc"]])
252-
> summary(meuse)
254+
> print(summary(meuse))
253255
x y cadmium copper
254256
Min. :178605 Min. :329714 Min. : 0.200 Min. : 14.00
255257
1st Qu.:179371 1st Qu.:330762 1st Qu.: 0.800 1st Qu.: 23.00
@@ -273,7 +275,7 @@ Data attributes:
273275
Mean : 7.478 Fw :10 Mean : 290.3
274276
3rd Qu.: 9.000 Ab : 8 3rd Qu.: 450.0
275277
Max. :17.000 (Other):25 Max. :1000.0
276-
NA's :2 NA's : 1
278+
NAs :2 NAs : 1
277279
xxx xxy
278280
Min. :4.727 Min. :4.727
279281
1st Qu.:5.288 1st Qu.:5.288
@@ -315,7 +317,7 @@ NULL
315317
> fullgrid(meuse.grid) = TRUE
316318
> dim(meuse.grid[0,])
317319
[1] 8112 5
318-
> summary(meuse.grid[0,])
320+
> print(summary(meuse.grid[0,]))
319321
Object of class SpatialGridDataFrame
320322
Coordinates:
321323
min max
@@ -332,10 +334,10 @@ y 329620 40 104
332334
Data attributes:
333335
part.a part.b dist soil ffreq
334336
Mode:logical Mode:logical Mode:logical Mode:logical Mode:logical
335-
NA's:8112 NA's:8112 NA's:8112 NA's:8112 NA's:8112
337+
NAs :8112 NAs :8112 NAs :8112 NAs :8112 NAs :8112
336338
> dim(meuse.grid[,0])
337339
[1] 8112 5
338-
> summary(meuse.grid[,0])
340+
> print(summary(meuse.grid[,0]))
339341
Object of class SpatialGridDataFrame
340342
Coordinates:
341343
min max
@@ -352,10 +354,10 @@ y 329620 40 104
352354
Data attributes:
353355
part.a part.b dist soil ffreq
354356
Mode:logical Mode:logical Mode:logical Mode:logical Mode:logical
355-
NA's:8112 NA's:8112 NA's:8112 NA's:8112 NA's:8112
357+
NAs :8112 NAs :8112 NAs :8112 NAs :8112 NAs :8112
356358
> dim(meuse.grid[0,,0])
357359
[1] 8112 0
358-
> summary(meuse.grid[0,,0])
360+
> print(summary(meuse.grid[0,,0]))
359361
Object of class SpatialGridDataFrame
360362
Coordinates:
361363
min max
@@ -369,6 +371,8 @@ Grid attributes:
369371
cellcentre.offset cellsize cells.dim
370372
x 178460 40 78
371373
y 329620 40 104
374+
Data attributes:
375+
character(0)
372376
>
373377
> # SpatialPolygons:
374378
> L = as(meuse.riv, "SpatialPolygons")
@@ -598,4 +602,4 @@ Error in SpatialPointsDataFrame(pts, df, match.ID = TRUE) :
598602
>
599603
> proc.time()
600604
user system elapsed
601-
1.033 1.316 0.843
605+
0.783 0.067 0.842

tests/sp1.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
options("rgdal_show_exportToProj4_warnings"="none")
2+
source("utils/print.R")
3+
24
library(sp)
35
data(meuse)
46
x = meuse

tests/sp1.Rout.save

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

2-
R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
3-
Copyright (C) 2023 The R Foundation for Statistical Computing
4-
Platform: x86_64-pc-linux-gnu (64-bit)
2+
R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble"
3+
Copyright (C) 2025 The R Foundation for Statistical Computing
4+
Platform: x86_64-pc-linux-gnu
55

66
R is free software and comes with ABSOLUTELY NO WARRANTY.
77
You are welcome to redistribute it under certain conditions.
@@ -16,6 +16,8 @@ Type 'demo()' for some demos, 'help()' for on-line help, or
1616
Type 'q()' to quit R.
1717

1818
> options("rgdal_show_exportToProj4_warnings"="none")
19+
> source("utils/print.R")
20+
>
1921
> library(sp)
2022
> data(meuse)
2123
> x = meuse
@@ -92,15 +94,15 @@ Data attributes:
9294
Mean : 8.165 Mean :0.24002 Mean : 7.478
9395
3rd Qu.: 8.955 3rd Qu.:0.36407 3rd Qu.: 9.000
9496
Max. :10.520 Max. :0.88039 Max. :17.000
95-
NA's :2
97+
NAs :2
9698
landuse dist.m
9799
W :50 Min. : 10.0
98100
Ah :39 1st Qu.: 80.0
99101
Am :22 Median : 270.0
100102
Fw :10 Mean : 290.3
101103
Ab : 8 3rd Qu.: 450.0
102104
(Other):25 Max. :1000.0
103-
NA's : 1
105+
NAs : 1
104106
> coordinates(x)
105107
xcoord ycoord
106108
1 181072 333611
@@ -331,4 +333,4 @@ Data attributes:
331333
>
332334
> proc.time()
333335
user system elapsed
334-
0.577 0.051 0.622
336+
0.263 0.037 0.291

tests/utils/print.R

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## print "NAs" as in R >= 4.6.0 to match reference output
2+
if (getRversion() < "4.6.0") {
3+
print <- function (x) {
4+
if (inherits(x, "summary.Spatial"))
5+
x$data <- sub("NA's", "NAs ", x$data, fixed = TRUE)
6+
else if (is.table(x) && is.character(x))
7+
x <- sub("NA's", "NAs ", x, fixed = TRUE)
8+
base::print(x)
9+
}
10+
}

tests/zerodist.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
options("rgdal_show_exportToProj4_warnings"="none")
2+
source("utils/print.R")
3+
24
library(sp)
35
data(meuse)
46
# pick 10 rows

tests/zerodist.Rout.save

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

2-
R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
3-
Copyright (C) 2023 The R Foundation for Statistical Computing
4-
Platform: x86_64-pc-linux-gnu (64-bit)
2+
R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble"
3+
Copyright (C) 2025 The R Foundation for Statistical Computing
4+
Platform: x86_64-pc-linux-gnu
55

66
R is free software and comes with ABSOLUTELY NO WARRANTY.
77
You are welcome to redistribute it under certain conditions.
@@ -16,6 +16,8 @@ Type 'demo()' for some demos, 'help()' for on-line help, or
1616
Type 'q()' to quit R.
1717

1818
> options("rgdal_show_exportToProj4_warnings"="none")
19+
> source("utils/print.R")
20+
>
1921
> library(sp)
2022
> data(meuse)
2123
> # pick 10 rows
@@ -65,15 +67,15 @@ Data attributes:
6567
Mean : 8.165 Mean :0.24002 Mean : 7.478
6668
3rd Qu.: 8.955 3rd Qu.:0.36407 3rd Qu.: 9.000
6769
Max. :10.520 Max. :0.88039 Max. :17.000
68-
NA's :2
70+
NAs :2
6971
landuse dist.m
7072
W :50 Min. : 10.0
7173
Ah :39 1st Qu.: 80.0
7274
Am :22 Median : 270.0
7375
Fw :10 Mean : 290.3
7476
Ab : 8 3rd Qu.: 450.0
7577
(Other):25 Max. :1000.0
76-
NA's : 1
78+
NAs : 1
7779
> meusedup3 <- subset(meusedup, !(1:nrow(meusedup) %in% zd[,2]))
7880
> print(summary(meusedup3))
7981
Object of class SpatialPointsDataFrame
@@ -100,15 +102,15 @@ Data attributes:
100102
Mean : 8.165 Mean :0.24002 Mean : 7.478
101103
3rd Qu.: 8.955 3rd Qu.:0.36407 3rd Qu.: 9.000
102104
Max. :10.520 Max. :0.88039 Max. :17.000
103-
NA's :2
105+
NAs :2
104106
landuse dist.m
105107
W :50 Min. : 10.0
106108
Ah :39 1st Qu.: 80.0
107109
Am :22 Median : 270.0
108110
Fw :10 Mean : 290.3
109111
Ab : 8 3rd Qu.: 450.0
110112
(Other):25 Max. :1000.0
111-
NA's : 1
113+
NAs : 1
112114
> dim(meuse)
113115
[1] 155 14
114116
> dim(meusedup2)
@@ -120,4 +122,4 @@ Data attributes:
120122
>
121123
> proc.time()
122124
user system elapsed
123-
0.544 0.048 0.586
125+
0.257 0.044 0.291

0 commit comments

Comments
 (0)