Debian Codegraph @

R/sp.R

raw
1 #' @templateVar class SpatialPolygonsDataFrame
2 #' @template title_desc_tidy
3 #'
4 #' @description Note that the `sf` package now defines tidy spatial objects
5 #' and is the recommended approach to spatial data. `sp` tidiers are now
6 #' deprecated in favor of `sf::st_as_sf()` and coercion methods found in
7 #' other packages. See
8 #' \url{https://r-spatial.org/r/2023/05/15/evolution4.html} for more on
9 #' migration from retiring spatial packages.
10 #'
11 #' @param x A `SpatialPolygonsDataFrame`, `SpatialPolygons`, `Polygons`,
12 #' `Polygon`, `SpatialLinesDataFrame`, `Lines` or `Line` object.
13 #' @param region name of variable used to split up regions
14 #' @param ... not used by this method
15 #'
16 #' @name sp_tidiers
17 #'
18 NULL
19
20 #' @rdname sp_tidiers
21 #' @export
22 #' @method tidy SpatialPolygonsDataFrame
23 tidy.SpatialPolygonsDataFrame <- function(x, region = NULL, ...) {
24 lifecycle::deprecate_stop(
25 when = "1.0.4",
26 what = "tidy.SpatialPolygonsDataFrame()",
27 details = "Please use functions from the sf package, namely `sf::st_as_sf()`, in favor of sp tidiers."
28 )
29 }
30
31 #' @rdname sp_tidiers
32 #' @export
33 #' @method tidy SpatialPolygons
34 tidy.SpatialPolygons <- function(x, ...) {
35 lifecycle::deprecate_stop(
36 when = "1.0.4",
37 what = "tidy.SpatialPolygons()",
38 details = "Please use functions from the sf package, namely `sf::st_as_sf()`, in favor of sp tidiers."
39 )
40 }
41
42
43 #' @rdname sp_tidiers
44 #' @export
45 #' @method tidy Polygons
46 tidy.Polygons <- function(x, ...) {
47 lifecycle::deprecate_stop(
48 when = "1.0.4",
49 what = "tidy.Polygons()",
50 details = "Please use functions from the sf package, namely `sf::st_as_sf()`, in favor of sp tidiers."
51 )
52 }
53
54 #' @rdname sp_tidiers
55 #' @export
56 #' @method tidy Polygon
57 tidy.Polygon <- function(x, ...) {
58 lifecycle::deprecate_stop(
59 when = "1.0.4",
60 what = "tidy.Polygon()",
61 details = "Please use functions from the sf package, namely `sf::st_as_sf()`, in favor of sp tidiers."
62 )
63 }
64
65 #' @rdname sp_tidiers
66 #' @export
67 #' @method tidy SpatialLinesDataFrame
68 tidy.SpatialLinesDataFrame <- function(x, ...) {
69 lifecycle::deprecate_stop(
70 when = "1.0.4",
71 what = "tidy.SpatialLinesDataFrame()",
72 details = "Please use functions from the sf package, namely `sf::st_as_sf()`, in favor of sp tidiers."
73 )
74 }
75
76 #' @rdname sp_tidiers
77 #' @export
78 #' @method tidy Lines
79 tidy.Lines <- function(x, ...) {
80 lifecycle::deprecate_stop(
81 when = "1.0.4",
82 what = "tidy.Lines()",
83 details = "Please use functions from the sf package, namely `sf::st_as_sf()`, in favor of sp tidiers."
84 )
85 }
86
87 #' @rdname sp_tidiers
88 #' @export
89 #' @method tidy Line
90 tidy.Line <- function(x, ...) {
91 lifecycle::deprecate_stop(
92 when = "1.0.4",
93 what = "tidy.Line()",
94 details = "Please use functions from the sf package, namely `sf::st_as_sf()`, in favor of sp tidiers."
95 )
96 }