Browse Source

travis

master
boB Rudis 5 years ago
parent
commit
dd9be05a5b
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 3
      DESCRIPTION
  2. 26
      tests/testthat/test-statebins.R

3
DESCRIPTION

@ -28,8 +28,7 @@ License: MIT + file LICENSE
Suggests:
testthat,
viridis,
RColorBrewer,
cdcfluview
RColorBrewer
Depends:
R (>= 3.2.0),
Imports:

26
tests/testthat/test-statebins.R

@ -2,25 +2,37 @@ context("basic functionality")
test_that("we can do something", {
require(ggplot2)
require(statebins)
flu <- cdcfluview::ili_weekly_activity_indicators(2017)
data(USArrests)
USArrests$state <- rownames(USArrests)
a1 <- USArrests
a2 <- USArrests
a3 <- USArrests
a1$f <- 1
a2$f <- 2
a3$f <- 3
ggplot(flu, aes(state=statename, fill=activity_level)) +
a4 <- rbind.data.frame(rbind.data.frame(a1, a2), a3)
ggplot(a4, aes(state=state, fill=Assault)) +
geom_statebins() +
coord_equal() +
ggplot2::facet_wrap(~weekend) +
labs(title="2017-18 Flu Season ILI Activity Level") +
ggplot2::facet_wrap(~f) +
theme_statebins() -> gg
gb <- ggplot_build(gg)
data(USArrests)
USArrests$state <- rownames(USArrests)
expect_equal(length(gb$plot$facet), 3)
statebins(USArrests, value_col="Assault", name = "Assault") +
theme_statebins(legend_position="right") -> gg
gb <- ggplot_build(gg)
expect_equal(length(gb$plot$facet), 2)
})

Loading…
Cancel
Save