Skip to content

Commit

Permalink
Remove dependencies on maptools and rgeos (#2297)
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy authored Oct 5, 2023
1 parent 0469eab commit 50c50ea
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 7 deletions.
3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,13 @@ Suggests:
webshot,
listviewer,
dendextend,
maptools,
rgeos,
sf,
png,
IRdisplay,
processx,
plotlyGeoAssets,
forcats,
withr,
palmerpenguins,
rversions,
reticulate,
Expand Down
2 changes: 1 addition & 1 deletion man/reexports.Rd

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

1 change: 1 addition & 0 deletions tests/testthat/test-animate-highlight.R
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ test_that("animation button can be customized", {
test_that("sf works with crosstalk", {
skip_if_not_installed("sf")
skip_if_not_installed("s2")
skip_if_not_installed("ggthemes")

nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
# shared data will make the polygons "query-able"
Expand Down
5 changes: 3 additions & 2 deletions tests/testthat/test-ggplot-date.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@


test_that("datetimes are converted to e.g. 2013-01-02 05:00:00", {
withr::local_locale(c("LC_TIME" = "en_US"))
in.str <- c("17 Mar 1983 06:33:44 AM",
"17 Mar 1984 01:59:55 PM")
"17 Mar 1984 01:59:55 PM")
time.obj <- strptime(in.str, "%d %b %Y %I:%M:%S %p")
out.str <- strftime(time.obj, "%Y-%m-%d %H:%M:%S")
df <- rbind(data.frame(who = "me", time.obj, dollars = c(1.1, 5.6)),
data.frame(who = "you", time.obj, dollars = c(10.2, 0)))
gg <- qplot(time.obj, dollars, data = df, color = who, geom = "line")
gg <- ggplot(aes(time.obj, dollars, color = who), data = df) + geom_line()
info <- expect_doppelganger_built(gg, "date-strings")
expect_equivalent(length(info$data), 2)
for(trace in info$data[1:2]){
Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-ggplot-hex.R
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
d <- ggplot(diamonds, aes(carat, price))

test_that("geom_hex", {
skip_if_not_installed("hexbin")
g <- d + geom_hex()
l <- expect_doppelganger_built(g, "hex-basic")
expect_true(length(l$data) > 1)
})


test_that("geom_hex with bins", {
skip_if_not_installed("hexbin")
g <- d + geom_hex(bins = 10)
l <- expect_doppelganger_built(g, "hex-bins")
expect_true(length(l$data) > 1)
})

test_that("geom_hex with binwidth", {
skip_if_not_installed("hexbin")
g <- d + geom_hex(binwidth = c(1, 1000))
l <- expect_doppelganger_built(g, "hex-binwidth")
expect_true(length(l$data) > 1)
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-ggplot-sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ test_that("sf aspect ratio is correct", {
test_that("works with a blank theme", {
skip_if_not_installed("sf")
skip_if_not_installed("s2")
skip_if_not_installed("ggthemes")

nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)
p <- ggplot(nc) + geom_sf() +
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-plotly-sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ test_that("Can plot sfc with a missing crs", {

test_that("plot_ly() defaults to blank axes", {
skip_if_not_installed("sf")
skip_if_not_installed("maptools")
skip_if_not_installed("rgeos")

m <- sf::st_as_sf(maps::map("world", plot = FALSE, fill = TRUE))

Expand Down

0 comments on commit 50c50ea

Please sign in to comment.