Skip to content

Commit 15da72f

Browse files
committed
Transform built-in datasets to sf objects instead of sp.
1 parent 79edf12 commit 15da72f

11 files changed

+27
-14
lines changed

DESCRIPTION

+1-1
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,

R/data.R

+10-10
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 <- utils::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

@@ -42,7 +42,7 @@ NULL
4242
#' @description Administrative borders of Switzerland (level 1)
4343
#' @details This dataset comes from <https://gadm.org>.
4444
#' It was downloaded using [raster::getData()].
45-
#' @format `sp::SpatialPolygonsDataFrame`
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

+6
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

+4
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

+3
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

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/breweries91.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/gadmCHE.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)