Skip to content

Commit

Permalink
CRAN submisison 1.0-14
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer committed Jul 10, 2023
1 parent d20be5d commit e6e5696
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 34 deletions.
4 changes: 2 additions & 2 deletions R/spatstat.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ check_spatstat <- function(pkg, X = NULL) {
if (!requireNamespace(pkg, quietly = TRUE))
stop("package ", pkg, " required, please install it (or the full spatstat package) first", call. = FALSE)
spst_ver <- try(packageVersion("spatstat"), silent = TRUE)
if (!inherits(spst_ver, "try-error") && spst_ver < 2.0-0)
stop(wrp(paste("You have an old version of spatstat installed which is incompatible with ", pkg,
if (!inherits(spst_ver, "try-error") && spst_ver < "2.0-0")
stop(wrp(paste0("You have an old version of spatstat installed that is incompatible with ", pkg,
". Please update spatstat (or uninstall it).")), call. = FALSE)
if (!is.null(X))
check_spatstat_ll(X)
Expand Down
2 changes: 1 addition & 1 deletion tests/aggregate.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ s = st_sf(a = 1:2, geom = st_sfc(pl1, pl2))
(a = aggregate(s, list(c(1,1)), mean, do_union = FALSE))
(a = aggregate(s, list(c(1,1)), mean, do_union = TRUE))
# expect_warning(st_cast(a, "POINT"))
if (require(sp, quietly = TRUE)) {
if (suppressPackageStartupMessages(require(sp, quietly = TRUE))) {
demo(meuse_sf, echo = FALSE, ask = FALSE)
a = aggregate(meuse_sf, list(meuse_sf$soil), mean)
print(attributes(a)$agr)
Expand Down
6 changes: 3 additions & 3 deletions tests/aggregate.Rout.save
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

R version 4.3.0 (2023-04-21) -- "Already Tomorrow"
R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

Expand Down Expand Up @@ -40,7 +40,7 @@ CRS: NA
Group.1 a geometry
1 1 1.5 POLYGON ((1 0, 0 0, 0 1, 1 ...
> # expect_warning(st_cast(a, "POINT"))
> if (require(sp, quietly = TRUE)) {
> if (suppressPackageStartupMessages(require(sp, quietly = TRUE))) {
+ demo(meuse_sf, echo = FALSE, ask = FALSE)
+ a = aggregate(meuse_sf, list(meuse_sf$soil), mean)
+ print(attributes(a)$agr)
Expand Down Expand Up @@ -109,4 +109,4 @@ CRS: NA
>
> proc.time()
user system elapsed
1.149 0.773 1.033
1.330 0.635 1.259
2 changes: 1 addition & 1 deletion tests/crs.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ if (sf_extSoftVersion()["USE_PROJ_H"] == "true" || sf_proj_info("have_datum_file
"datum files not installed"
}

if (require(sp, quietly = TRUE)) {
if (suppressPackageStartupMessages(require(sp, quietly = TRUE))) {
x0 = sp::CRS("+init=epsg:4326")
cat(sp::wkt(x0), "\n")
x = st_crs(x0)
Expand Down
9 changes: 6 additions & 3 deletions tests/crs.Rout.save
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

R version 4.2.3 (2023-03-15) -- "Shortstop Beagle"
R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

Expand Down Expand Up @@ -82,7 +82,7 @@ POINT (111319.5 111325.1)
+ }
[1] "datum files installed"
>
> if (require(sp, quietly = TRUE)) {
> if (suppressPackageStartupMessages(require(sp, quietly = TRUE))) {
+ x0 = sp::CRS("+init=epsg:4326")
+ cat(sp::wkt(x0), "\n")
+ x = st_crs(x0)
Expand Down Expand Up @@ -196,6 +196,9 @@ GEOGCRS["WGS 84",
AREA["World."],
BBOX[-90,-180,90,180]],
ID["EPSG",4326]]
Warning message:
In CPL_crs_from_input(x) :
GDAL Message 1: +init=epsg:XXXX syntax is deprecated. It might return a CRS with a non-EPSG compliant axis order.
>
> # https://github.com/r-spatial/sf/issues/1170
> g = st_as_sfc("POLYGON ((-61.66957 10.69214, -61.565 10.75728, -61.37453 10.77654, -61.40721 10.60681, -61.66957 10.69214))")
Expand All @@ -213,4 +216,4 @@ GEOGCRS["WGS 84",
>
> proc.time()
user system elapsed
1.345 0.712 1.171
1.344 0.669 1.160
2 changes: 1 addition & 1 deletion tests/dist.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ st_point(c(4,0)),
crs = 4326
)

if (require(sp, quietly = TRUE)) {
if (suppressPackageStartupMessages(require(sp, quietly = TRUE))) {
d.sf = st_distance(x, y)
d.sp = spDists(as(x, "Spatial"), as(y, "Spatial"))
units(d.sp) = as_units("km")
Expand Down
8 changes: 4 additions & 4 deletions tests/dist.Rout.save
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

R version 4.2.0 (2022-04-22) -- "Vigorous Calisthenics"
Copyright (C) 2022 The R Foundation for Statistical Computing
R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
Expand Down Expand Up @@ -35,7 +35,7 @@ Type 'q()' to quit R.
+ crs = 4326
+ )
>
> if (require(sp, quietly = TRUE)) {
> if (suppressPackageStartupMessages(require(sp, quietly = TRUE))) {
+ d.sf = st_distance(x, y)
+ d.sp = spDists(as(x, "Spatial"), as(y, "Spatial"))
+ units(d.sp) = as_units("km")
Expand Down Expand Up @@ -109,4 +109,4 @@ Error in st_line_sample(ls, density = 1/1000) :
>
> proc.time()
user system elapsed
1.343 0.096 1.431
1.257 0.770 1.138
2 changes: 1 addition & 1 deletion tests/grid.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pushViewport(st_viewport(nc))
invisible(lapply(st_geometry(nc), function(x) grid.draw(st_as_grob(x, gp = gpar(fill = 'red')))))

# POINTS:
if (require(sp, quietly = TRUE)) {
if (suppressPackageStartupMessages(require(sp, quietly = TRUE))) {
data(meuse, package = "sp")
meuse_sf = st_as_sf(meuse, coords = c("x", "y"), crs = 28992, agr = "constant")
grid.newpage()
Expand Down
8 changes: 4 additions & 4 deletions tests/grid.Rout.save
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

R version 4.2.0 (2022-04-22) -- "Vigorous Calisthenics"
Copyright (C) 2022 The R Foundation for Statistical Computing
R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
Expand Down Expand Up @@ -32,7 +32,7 @@ Type 'q()' to quit R.
> invisible(lapply(st_geometry(nc), function(x) grid.draw(st_as_grob(x, gp = gpar(fill = 'red')))))
>
> # POINTS:
> if (require(sp, quietly = TRUE)) {
> if (suppressPackageStartupMessages(require(sp, quietly = TRUE))) {
+ data(meuse, package = "sp")
+ meuse_sf = st_as_sf(meuse, coords = c("x", "y"), crs = 28992, agr = "constant")
+ grid.newpage()
Expand Down Expand Up @@ -80,4 +80,4 @@ Type 'q()' to quit R.
>
> proc.time()
user system elapsed
1.496 0.059 1.566
1.462 0.800 1.365
4 changes: 3 additions & 1 deletion tests/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ l3 = st_linestring(matrix(runif(6)-0.5,,2))
s = st_sf(a=2:4, b=st_sfc(l1,l2,l3))
plot(s, col = s$a, axes = FALSE)
plot(s, col = s$a)
attr(s$b, "proj4string") = sp::CRS("+proj=longlat +ellps=WGS84 +no_defs")@projargs
if (suppressPackageStartupMessages(require(sp, quietly = TRUE))) {
attr(s$b, "proj4string") = sp::CRS("+proj=longlat +ellps=WGS84 +no_defs")@projargs
}
plot(s, col = s$a, axes = TRUE)
plot(s, col = s$a, lty = s$a, lwd = s$a, pch = s$a, type = 'b')
l4 = st_linestring(matrix(runif(6),,2))
Expand Down
10 changes: 6 additions & 4 deletions tests/plot.Rout.save
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

R version 4.2.0 (2022-04-22) -- "Vigorous Calisthenics"
Copyright (C) 2022 The R Foundation for Statistical Computing
R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
Expand All @@ -27,7 +27,9 @@ Type 'q()' to quit R.
+ s = st_sf(a=2:4, b=st_sfc(l1,l2,l3))
+ plot(s, col = s$a, axes = FALSE)
+ plot(s, col = s$a)
+ attr(s$b, "proj4string") = sp::CRS("+proj=longlat +ellps=WGS84 +no_defs")@projargs
+ if (suppressPackageStartupMessages(require(sp, quietly = TRUE))) {
+ attr(s$b, "proj4string") = sp::CRS("+proj=longlat +ellps=WGS84 +no_defs")@projargs
+ }
+ plot(s, col = s$a, axes = TRUE)
+ plot(s, col = s$a, lty = s$a, lwd = s$a, pch = s$a, type = 'b')
+ l4 = st_linestring(matrix(runif(6),,2))
Expand Down Expand Up @@ -148,4 +150,4 @@ There were 13 warnings (use warnings() to see them)
>
> proc.time()
user system elapsed
5.863 0.119 6.022
4.822 0.828 4.857
2 changes: 1 addition & 1 deletion tests/roundtrip.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pol3 = list(outer + 24)
mp = list(pol1,pol2,pol3)
mp1 = st_multipolygon(mp)
sf = st_sf(a=1, st_sfc(mp1))
if (require(sp, quietly = TRUE)) {
if (suppressPackageStartupMessages(require(sp, quietly = TRUE))) {
a = as(sf, "Spatial")
print(class(a))
b = st_as_sf(a)
Expand Down
11 changes: 7 additions & 4 deletions tests/roundtrip.Rout.save
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

R version 4.2.2 (2022-10-31) -- "Innocent and Trusting"
Copyright (C) 2022 The R Foundation for Statistical Computing
R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
Expand Down Expand Up @@ -29,7 +29,7 @@ Type 'q()' to quit R.
> mp = list(pol1,pol2,pol3)
> mp1 = st_multipolygon(mp)
> sf = st_sf(a=1, st_sfc(mp1))
> if (require(sp, quietly = TRUE)) {
> if (suppressPackageStartupMessages(require(sp, quietly = TRUE))) {
+ a = as(sf, "Spatial")
+ print(class(a))
+ b = st_as_sf(a)
Expand Down Expand Up @@ -83,7 +83,10 @@ attr(,"package")
+
+ detach("package:sp")
+ }
Warning message:
In CPL_crs_from_input(x) :
GDAL Message 1: +init=epsg:XXXX syntax is deprecated. It might return a CRS with a non-EPSG compliant axis order.
>
> proc.time()
user system elapsed
1.364 0.068 1.434
1.666 0.736 1.524
2 changes: 1 addition & 1 deletion tests/sfc.R
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ plot(st_jitter(st_geometry(nc), factor = .01), add = TRUE, col = '#ff8888')
st_jitter(st_sfc(st_point(0:1)), amount = .1)

# st_bbox:
if (require(sp, quietly = TRUE) && require(raster, quietly = TRUE)) {
if (suppressPackageStartupMessages(require(sp, quietly = TRUE)) && require(raster, quietly = TRUE)) {
demo(meuse, ask = FALSE, echo = FALSE)
suppressWarnings(st_bbox(meuse))
crs = suppressWarnings(st_crs(meuse))
Expand Down
6 changes: 3 additions & 3 deletions tests/sfc.Rout.save
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

R version 4.3.0 (2023-04-21) -- "Already Tomorrow"
R version 4.3.1 (2023-06-16) -- "Beagle Scouts"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

Expand Down Expand Up @@ -821,7 +821,7 @@ CRS: NA
POINT (-0.0500922 0.992953)
>
> # st_bbox:
> if (require(sp, quietly = TRUE) && require(raster, quietly = TRUE)) {
> if (suppressPackageStartupMessages(require(sp, quietly = TRUE)) && require(raster, quietly = TRUE)) {
+ demo(meuse, ask = FALSE, echo = FALSE)
+ suppressWarnings(st_bbox(meuse))
+ crs = suppressWarnings(st_crs(meuse))
Expand Down Expand Up @@ -1088,4 +1088,4 @@ CRS: NA
>
> proc.time()
user system elapsed
6.642 0.811 6.564
6.713 0.877 6.702

0 comments on commit e6e5696

Please sign in to comment.