data("measlesWeserEms")
## animate the weekly counts of measles (during weeks 12-16 only, for speed)
if (interactive() && require("animation")) {
oldwd <- setwd(tempdir()) # to not clutter up the current working dir
saveHTML(animate(measlesWeserEms, tps=12:16),
title="Evolution of the measles epidemic in the Weser-Ems region",
ani.width=500, ani.height=600)
setwd(oldwd)
}
if (FALSE) {
## animate the weekly incidence of measles (per 100'000 inhabitants),
## and label the time series plot with dates in a specified format
animate(measlesWeserEms, tps=12:16,
population = measlesWeserEms@map$POPULATION / 100000,
timeplot = list(as.Date = TRUE,
scales = list(x = list(format = "%G/%V"))))
}
Run the code above in your browser using DataLab