Comments (2)
How about something like this:
library(outbreaks)
library(incidence2)
dat <- ebola_sim_clean$linelist
inci <- incidence(
dat,
date_index = date_of_onset,
interval = "1 week",
groups = gender
)
inci
#> An incidence2 object: 109 x 3
#> [5829 cases from days 2014-W15 to 2015-W18]
#> [interval: 1 week]
#> [cumulative: FALSE]
#>
#> date_index gender count
#> <yrwk> <fct> <int>
#> 1 2014-W15 f 1
#> 2 2014-W16 m 1
#> 3 2014-W17 f 4
#> 4 2014-W17 m 1
#> 5 2014-W18 f 4
#> 6 2014-W19 f 9
#> 7 2014-W19 m 3
#> 8 2014-W20 f 7
#> 9 2014-W20 m 10
#> 10 2014-W21 f 8
#> # … with 99 more rows
keep_first(inci, 5)
#> An incidence2 object: 7 x 3
#> [23 cases from days 2014-W15 to 2014-W19]
#> [interval: 1 week]
#> [cumulative: FALSE]
#>
#> date_index gender count
#> <yrwk> <fct> <int>
#> 1 2014-W15 f 1
#> 2 2014-W16 m 1
#> 3 2014-W17 f 4
#> 4 2014-W17 m 1
#> 5 2014-W18 f 4
#> 6 2014-W19 f 9
#> 7 2014-W19 m 3
keep_last(inci, 5)
#> An incidence2 object: 10 x 3
#> [199 cases from days 2015-W14 to 2015-W18]
#> [interval: 1 week]
#> [cumulative: FALSE]
#>
#> date_index gender count
#> <yrwk> <fct> <int>
#> 1 2015-W14 f 29
#> 2 2015-W14 m 25
#> 3 2015-W15 f 18
#> 4 2015-W15 m 24
#> 5 2015-W16 f 26
#> 6 2015-W16 m 18
#> 7 2015-W17 f 18
#> 8 2015-W17 m 22
#> 9 2015-W18 f 10
#> 10 2015-W18 m 9
from incidence2.
from incidence2.
Related Issues (20)
- Should we only provide getters for the variable names (not values)?
- Should a `find_peaks()` like function be in incidence HOT 1
- Restore some of the header information for incidence2 objects HOT 1
- Add minimal `new_incidence()` constructor
- Should `complete_dates()` use a different default `by` argument for POSIXct dates? HOT 7
- Consider warning when incidence objects are created with POSIXct dates HOT 1
- Error: object 'date_onset' not found HOT 1
- Error: show_cases dont work HOT 9
- reinstate `day` interval HOT 1
- Document `day` interval in vignettes.
- `plot.incidence2()` fails with `grates_period` dates HOT 3
- Make makefile more usable by others
- Ensure data.table uses 2 threads max in docs and examples
- NA values in observations cause a value of NA to be returned HOT 10
- Document how to handle grouped line list columns HOT 4
- Allow user to suppress NA warning in count variables
- vignette documentation on building upon incidence2 HOT 2
- Fix formatting of old news entries HOT 1
- Rework the devel news entry HOT 1
- 2.3.0 release TODO
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from incidence2.