Skip to content

Commit

Permalink
Revert "add sf_make_aware_pgk(); #2131"
Browse files Browse the repository at this point in the history
This reverts commit f5d6da5.
  • Loading branch information
edzer committed Oct 2, 2024
1 parent bd552fa commit 4c893e3
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 43 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ LinkingTo:
VignetteBuilder:
knitr
Encoding: UTF-8
RoxygenNote: 7.3.2
RoxygenNote: 7.3.1
Roxygen: list(markdown = TRUE)
Config/testthat/edition: 2
Config/needs/coverage: XML
Expand Down
4 changes: 1 addition & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -406,14 +406,13 @@ export(gdal_utils)
export(gdal_write)
export(gdal_write_mdim)
export(get_key_pos)
export(make_sf_aware)
export(plot_sf)
export(rawToHex)
export(read_sf)
export(sf.colors)
export(sf_add_proj_units)
export(sf_extSoftVersion)
export(sf_make_aware)
export(sf_make_aware_pkg)
export(sf_proj_info)
export(sf_proj_network)
export(sf_proj_pipelines)
Expand Down Expand Up @@ -580,7 +579,6 @@ importFrom(units,as_units)
importFrom(units,drop_units)
importFrom(units,make_unit_label)
importFrom(units,set_units)
importFrom(utils,assignInMyNamespace)
importFrom(utils,compareVersion)
importFrom(utils,globalVariables)
importFrom(utils,head)
Expand Down
2 changes: 1 addition & 1 deletion R/init.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' @importFrom utils head tail object.size str packageVersion compareVersion globalVariables assignInMyNamespace
#' @importFrom utils head object.size str tail packageVersion compareVersion globalVariables
#' @importFrom stats aggregate dist na.omit rbinom runif setNames
#' @importFrom tools file_ext file_path_sans_ext
#' @importFrom methods as new slot slotNames slot<-
Expand Down
17 changes: 2 additions & 15 deletions R/sf_aware.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# the feature was introduced (Jul 23, 2024).
# New packages wanting to opt-in should use `make_sf_aware()` in their .onLoad().
known_sf_aware <- c(".globalenv", "sf", "base", "utils", "stats",
"rsample", # called by spatialsample
"od", # only imports sfheaders; used by abstr
"igr", # published Jul 27, 2024
"weatherOz", # published Jul 26, 2024
Expand All @@ -30,27 +31,13 @@ known_sf_aware <- c(".globalenv", "sf", "base", "utils", "stats",
#' for packages: use the sticky geometry [ behaviour of sf in package code
#'
#' for packages: use the sticky geometry [ behaviour of sf in package code
#' @name sf_make_aware
#' @param env environment
#' @param value logical; default `TRUE`
#' @export
sf_make_aware <- function(env = parent.frame(), value = TRUE) {
make_sf_aware <- function(env = parent.frame(), value = TRUE) {
env$.__sf_aware__. <- value
}

#' @export
#' @name sf_make_aware
#' @param pkg package name
sf_make_aware_pkg <- function(pkg) {
stopifnot(is.character(pkg), length(pkg) == 1)
old = known_sf_aware
if (pkg %in% old)
message(paste("package", pkg, "is already sf-aware"))
else
utils::assignInMyNamespace("known_sf_aware", c(pkg, known_sf_aware))
invisible(old)
}

is_sf_aware <- function(env = parent.frame(2)) {
top <- topenv(env)

Expand Down
2 changes: 0 additions & 2 deletions R/tidyverse.R
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ select.sf <- function(.data, ...) {
}

#' @name tidyverse
#' @param .before see original docs
#' @param .after see original docs
relocate.sf = function(.data, ..., .before = NULL, .after = NULL) {
st_as_sf(NextMethod())
}
Expand Down
11 changes: 3 additions & 8 deletions man/sf_make_aware.Rd → man/make_sf_aware.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions man/tidyverse.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions tests/spatstat.Rout.save
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

R version 4.4.1 (2024-06-14) -- "Race for Your Life"
R version 4.3.3 (2024-02-29) -- "Angel Food Cake"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Expand Down Expand Up @@ -126,9 +126,8 @@ Type 'q()' to quit R.
+ (y = st_as_sfc(as.psp(sf)))
+ all.equal(st_geometry(x), y)
+ }
spatstat.univar 3.0-0
spatstat.geom 3.3-2
spatstat.random 3.3-1
spatstat.geom 3.2-9
spatstat.random 3.2-3
Simple feature collection with 51 features and 1 field
Geometry type: GEOMETRY
Dimension: XY
Expand Down Expand Up @@ -168,4 +167,4 @@ In st_as_sfc.owin(spatstat.geom::as.owin(x)) :
>
> proc.time()
user system elapsed
1.768 1.389 1.788
2.074 1.308 1.918

0 comments on commit 4c893e3

Please sign in to comment.