reconhub / incidence

☣:chart_with_upwards_trend::chart_with_downwards_trend:☣ Compute and visualise incidence
https://reconhub.github.io/incidence
Other
58 stars 13 forks source link

Maintain user-defined levels and column order for import/export/plotting #79

Closed zkamvar closed 5 years ago

zkamvar commented 5 years ago

This will fix #77 and fix #78.

library("incidence")
library("ggplot2")
g <- sample(LETTERS[1:5], 100, replace = TRUE)
g <- factor(g, levels = LETTERS[5:1])
i <- incidence(rpois(100, 10), groups = g)
i
#> <incidence object>
#> [100 cases from days 1 to 20]
#> [5 groups: E, D, C, B, A]
#> 
#> $counts: matrix with 20 rows and 5 columns
#> $n: 100 cases in total
#> $dates: 20 dates marking the left-side of bins
#> $interval: 1 day
#> $timespan: 20 days
#> $cumulative: FALSE
plot(i)

Created on 2018-11-14 by the reprex package (v0.2.1)