|
@ -2,25 +2,37 @@ context("basic functionality") |
|
|
test_that("we can do something", { |
|
|
test_that("we can do something", { |
|
|
|
|
|
|
|
|
require(ggplot2) |
|
|
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() + |
|
|
geom_statebins() + |
|
|
coord_equal() + |
|
|
coord_equal() + |
|
|
ggplot2::facet_wrap(~weekend) + |
|
|
ggplot2::facet_wrap(~f) + |
|
|
labs(title="2017-18 Flu Season ILI Activity Level") + |
|
|
|
|
|
theme_statebins() -> gg |
|
|
theme_statebins() -> gg |
|
|
|
|
|
|
|
|
gb <- ggplot_build(gg) |
|
|
gb <- ggplot_build(gg) |
|
|
|
|
|
|
|
|
data(USArrests) |
|
|
expect_equal(length(gb$plot$facet), 3) |
|
|
|
|
|
|
|
|
USArrests$state <- rownames(USArrests) |
|
|
|
|
|
|
|
|
|
|
|
statebins(USArrests, value_col="Assault", name = "Assault") + |
|
|
statebins(USArrests, value_col="Assault", name = "Assault") + |
|
|
theme_statebins(legend_position="right") -> gg |
|
|
theme_statebins(legend_position="right") -> gg |
|
|
|
|
|
|
|
|
gb <- ggplot_build(gg) |
|
|
gb <- ggplot_build(gg) |
|
|
|
|
|
|
|
|
|
|
|
expect_equal(length(gb$plot$facet), 2) |
|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|