Comments (3)
@tjtnew thanks so much for these developments. I haven't tried it yet, but the above looks perfect. I like how you can set the month Dec-2014 in the centre of the bar, and the YYYY-MM-DD at the front end of the bar.
I will try to test further today, but perhaps its a quick answer - does the date_format = argument work the same if the interval is weeks or two weeks?
from incidence2.
Yes for single weeks. They default to being centred but can be changed to hitogram dates in the same way as above. 2 week intervals can never be centred and will always be dates (but you can use date_format to give them a different format) - see below and note the issue I need to fix on the y-axis labelling ;)
library(outbreaks)
library(incidence2)
dat <- ebola_sim_clean$linelist
xw<- incidence(dat, date_of_onset, interval = "week")
xw
#> An incidence2 object: 56 x 2
#> 5829 cases from 2014-W15 to 2015-W18
#> interval: 1 (Monday) week
#> cumulative: FALSE
#>
#> date_index count
#> <yrwk> <int>
#> 1 2014-W15 1
#> 2 2014-W16 1
#> 3 2014-W17 5
#> 4 2014-W18 4
#> 5 2014-W19 12
#> 6 2014-W20 17
#> 7 2014-W21 15
#> 8 2014-W22 19
#> 9 2014-W23 23
#> 10 2014-W24 21
#> # … with 46 more rows
# centred dates (default for yearweek, single months, quarters and years)
plot(xw, color = "white")
# centred dates (default for yearweek, single months, quarters and years)
plot(xw, color = "white", centre_dates = FALSE)
x2w<- incidence(dat, date_of_onset, interval = "2 weeks")
x2w
#> An incidence2 object: 28 x 2
#> 5829 cases from 2014-04-07 to 2015-05-03
#> interval: 14 days
#> cumulative: FALSE
#>
#> date_index count
#> <period> <int>
#> 1 2014-04-07 to 2014-04-20 2
#> 2 2014-04-21 to 2014-05-04 9
#> 3 2014-05-05 to 2014-05-18 29
#> 4 2014-05-19 to 2014-06-01 34
#> 5 2014-06-02 to 2014-06-15 44
#> 6 2014-06-16 to 2014-06-29 52
#> 7 2014-06-30 to 2014-07-13 72
#> 8 2014-07-14 to 2014-07-27 120
#> 9 2014-07-28 to 2014-08-10 166
#> 10 2014-08-11 to 2014-08-24 255
#> # … with 18 more rows
# centred dates (default for yearweek, single months, quarters and years)
plot(x2w, color = "white")
Created on 2021-05-20 by the reprex package (v2.0.0)
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.