Software Open Access

reconhub/incidence: Incidence version 1.7.0

Thibaut Jombart; Zhian N. Kamvar; Jun Cai; Juliet Pulliam; Sarah Chisholm; Rich FitzJohn; Jakob Schumacher; Sangeeta Bhatia

Incidence can now handle standardised weeks starting on any day thanks to the aweek package :tada:

library(incidence)
library(ggplot2)
library(cowplot)
d <- as.Date("2019-03-11") + -7:6
setNames(d, weekdays(d))
#>       Monday      Tuesday    Wednesday     Thursday       Friday 
#> "2019-03-04" "2019-03-05" "2019-03-06" "2019-03-07" "2019-03-08" 
#>     Saturday       Sunday       Monday      Tuesday    Wednesday 
#> "2019-03-09" "2019-03-10" "2019-03-11" "2019-03-12" "2019-03-13" 
#>     Thursday       Friday     Saturday       Sunday 
#> "2019-03-14" "2019-03-15" "2019-03-16" "2019-03-17"
imon <- incidence(d, "mon week") # also ISO week
itue <- incidence(d, "tue week")
iwed <- incidence(d, "wed week")
ithu <- incidence(d, "thu week")
ifri <- incidence(d, "fri week")
isat <- incidence(d, "sat week")
isun <- incidence(d, "sun week") # also MMWR week and EPI week

pmon <- plot(imon, show_cases = TRUE, labels_week = FALSE)
ptue <- plot(itue, show_cases = TRUE, labels_week = FALSE)
pwed <- plot(iwed, show_cases = TRUE, labels_week = FALSE)
pthu <- plot(ithu, show_cases = TRUE, labels_week = FALSE)
pfri <- plot(ifri, show_cases = TRUE, labels_week = FALSE)
psat <- plot(isat, show_cases = TRUE, labels_week = FALSE)
psun <- plot(isun, show_cases = TRUE, labels_week = FALSE)
s <- scale_x_date(limits = c(as.Date("2019-02-26"), max(d) + 7L))
plot_grid(
pmon + s,
ptue + s,
pwed + s,
pthu + s,
pfri + s,
psat + s,
psun + s)

multi-weeks/months/years can now be handled
library(incidence)
library(outbreaks)
d <- ebola_sim_clean$linelist$date_of_onset
h <- ebola_sim_clean$linelist$hospital
plot(incidence(d, interval = "1 epiweek", group = h))

plot(incidence(d, interval = "2 epiweeks", group = h))

plot(incidence(d, interval = "3 epiweeks", group = h))

plot(incidence(d, interval = "2 months", group = h))

<sup>Created on 2019-03-14 by the [reprex package](https://reprex.tidyverse.org) (v0.2.1)</sup>

Full set of changes NEW FEATURES NEW FUNCTIONS
  • make_breaks() will automatically calculate breaks from an incidence object for plotting.
  • scale_x_incidence() will produce a ggplot2 "ScaleContinuous" object to add to a ggplot.
DEPRECATED
  • plot.incidence() argument labels_iso is deprecated in favor of labels_week
  • Incidence objects will still have $isoweeks if the weeks are ISO 8601 standard, but users should rely intead on $weeks instead. The $isoweeks element will be removed in a future version of incidence.
  • as.incidence() argument isoweeks has been deprecated in favour of standard
DEPENDENCIES
  • ISOweek import changed to aweek
Documentation
  • Vignettes have been updated with examples.

Files (5.5 MB)
Name Size
reconhub/incidence-1.7.0.zip
md5:9a25688c650c72848663f898dbcd6944
5.5 MB Download
65
46
views
downloads
All versions This version
Views 656
Downloads 462
Data volume 238.3 MB11.1 MB
Unique views 466
Unique downloads 201

Share

Cite as