Skip to content
Closed
7 changes: 3 additions & 4 deletions tests/testthat/test-compiler-animation.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ if(require(maps)){
USpolygons <- map_data("state")
USpolygons$state <- state.abb[match(USpolygons$region, tolower(state.name))]

# Convert to data.table
setDT(UStornadoes)
UStornadoCounts <- UStornadoes[, .(count = .N), by = .(state, year)]
UStornadoes_dt <- as.data.table(copy(UStornadoes))
Comment thread
suhaani-agarwal marked this conversation as resolved.
Outdated
UStornadoCounts <- UStornadoes_dt[, .(count = .N), by = .(state, year)]

tornado.anim <- list(
map=ggplot()+
Expand All @@ -24,7 +23,7 @@ if(require(maps)){
geom_segment(aes(
x=startLong, y=startLat, xend=endLong, yend=endLat),
showSelected="year",
colour="#55B1F7", data=UStornadoes),
colour="#55B1F7", data=UStornadoes_dt),
ts=ggplot()+
make_tallrect(UStornadoCounts, "year")+
geom_line(aes(
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-compiler-fortify.r
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
context("Fortify")
library(sp)
library(ggplot2)
library(animint2)

test_that("Spatial polygons have correct ordering", {
make_square <- function(x = 0, y = 0, height = 1, width = 1){
delx <- width/2
dely <- height/2
Polygon(matrix(c(x + delx, x - delx,x - delx,x + delx,x + delx ,
y - dely,y - dely,y + dely,y + dely,y - dely), ncol = 2))
y - dely,y - dely,y + dely,y + dely,y - dely), ncol = 2))
}

make_hole <- function(x = 0, y = 0, height = .5, width = .5){
Expand Down