Skip to content

Commit 947ea17

Browse files
authored
chore: Convert internal datasets to use {sf} + require R 3.5 (#944)
1 parent a609a34 commit 947ea17

File tree

13 files changed

+36
-36
lines changed

13 files changed

+36
-36
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ URL: https://rstudio.github.io/leaflet/,
4848
https://github.com/rstudio/leaflet
4949
BugReports: https://github.com/rstudio/leaflet/issues
5050
Depends:
51-
R (>= 3.1.0)
51+
R (>= 3.5)
5252
Imports:
5353
crosstalk,
5454
htmltools,

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
* `{leaflet}` no longer install sp by default and attempts to convert object to sf internally before creating a map and warns when it fails conversion (@olivroy, #942).
44

5+
* The `breweries91`, `atlStorms2005`, and `gadmCHE` datasets are now `{sf}` objects (@olivroy, #944).
6+
7+
* `{leaflet}` now requires R 3.5 and above (@olivroy, #944).
8+
59
* Color palette improvements. All color palette functions now support all `{viridisLite}` palettes ("magma", "inferno", "plasma", "viridis", "cividis", "rocket", "mako", and "turbo") (@jack-davison, #924).
610

711
* Updated vignettes to replace `{sp}`/`{raster}` usage with `{sf}`/`{terra}` and their corresponding examples. (@jack-davison, #928)

R/data.R

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
#' plot(Lat ~ Long, data = uspop2000, cex = sqrt(p), asp = 1, col = rgb(1, 0, 0, .3))
1818

1919
if (FALSE) {
20-
uspop2000 <- NULL
21-
if (file.exists("inst/csv/uspop2000.csv")) {
22-
uspop2000 <- read.csv(
23-
text = readLines("inst/csv/uspop2000.csv", encoding = "UTF-8"),
24-
stringsAsFactors = FALSE
25-
)
26-
}
20+
uspop2000 <- NULL
21+
if (file.exists("inst/csv/uspop2000.csv")) {
22+
uspop2000 <- utils::read.csv(
23+
text = readLines("inst/csv/uspop2000.csv", encoding = "UTF-8"),
24+
stringsAsFactors = FALSE
25+
)
26+
}
2727
}
2828

2929
#' @docType data
@@ -32,7 +32,7 @@ if (file.exists("inst/csv/uspop2000.csv")) {
3232
#' @description Atlantic Ocean storms 2005
3333
#' @details This dataset contains storm tracks for selected storms
3434
#' in the Atlantic Ocean basin for the year 2005
35-
#' @format `sp::SpatialLinesDataFrame`
35+
#' @format `sf` object
3636
#' @family built in datasets
3737
NULL
3838

@@ -41,8 +41,8 @@ NULL
4141
#' @title Administrative borders of Switzerland (level 1)
4242
#' @description Administrative borders of Switzerland (level 1)
4343
#' @details This dataset comes from <https://gadm.org>.
44-
#' It was downloaded using [getData()].
45-
#' @format `sp::SpatialPolygonsDataFrame`
44+
#' It was downloaded using [raster::getData()].
45+
#' @format `sf` object
4646
#' @family built in datasets
4747
#' @source
4848
#' <https://gadm.org>
@@ -57,6 +57,6 @@ NULL
5757
#' subset of a larger database that was compiled by students at the
5858
#' University of Marburg for a seminar called
5959
#' "The Geography of Beer, sustainability in the food industry"
60-
#' @format `sp::SpatialPointsDataFrame`
60+
#' @format `sf` object
6161
#' @family built in datasets
6262
NULL

data-raw/atlStorms2005.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## code to prepare `atlStorms2005` dataset goes here
2+
# legacy script
3+
4+
atlStorms2005 <- sf::st_as_sf(atlStorms2005)
5+
6+
usethis::use_data(atlStorms2005, overwrite = TRUE)

data-raw/breweries91.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## code to prepare `breweries91` dataset goes here
2+
# legacy script
3+
breweries91 <- sf::st_as_sf(breweries91)
4+
usethis::use_data(breweries91, overwrite = TRUE)

data-raw/gadmCHE.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ gadmCHE$VARNAME_1 <- iconv(gadmCHE$VARNAME_1, "UTF-8", "ASCII//TRANSLIT")
1212
usethis::use_data(gadmCHE, overwrite = TRUE)
1313

1414
print(tools::showNonASCIIfile("data/gadmCHE.rda"))
15+
16+
# Convert to sf object
17+
gadmCHE <- sf::st_as_sf(gadmCHE)

data/atlStorms2005.rda

-336 Bytes
Binary file not shown.

data/breweries91.rda

450 Bytes
Binary file not shown.

data/gadmCHE.rda

25.9 KB
Binary file not shown.

man/atlStorms2005.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)