library(testthat)
library(NOAAEQ)
#Set context
context("Test NOAA EQ package")
# Test the data read and rawOut argument
EQdata<-eq_clean_data(file=system.file("extdata", "signif.txt", package = "NOAAEQ"))
#Test that the latitude and longitude are run through n
expect_is(EQdata$LATITUDE,"numeric")
expect_is(EQdata$LONGITUDE,"numeric")
# Test geom_timeline and geom_timeline_label by checking the layers of the ggplot
p<- EQplotCountry<-ggplot2::ggplot(dplyr::filter(EQdata,COUNTRY %in% c("USA","CHINA")),
mapping=ggplot2::aes(x=DATE,y=COUNTRY))+
geom_timeline(xmindate=lubridate::make_date(2015,1,1))+
geom_timeline_label(ggplot2::aes(orderdata=EQ_PRIMARY,
label=LOCATION_NAME),
xmindate=lubridate::make_date(2015,1,1),n_max=1)
expect_is(p$layers[[1]]$geom,"GeomTimeline")
expect_is(p$layers[[2]]$geom,"GeomTimelineLabel")
# Test the eq_map
p<-eq_map(EQdata[EQdata$COUNTRY=="USA"&EQdata$DATE>as.Date("2014-1-1","%Y-%m-%d"),],annot_col = "LOCATION_NAME")
expect_is(p,"leaflet")
# Test the eq_create_label equal rows coming in and out.
expect_equal(nrow(data.frame(eq_create_label(EQdata))),nrow(EQdata))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.