ProjectMOSAIC / mosaicData

R package with Project MOSAIC datasets
6 stars 6 forks source link

Add Births2015 #18

Closed rpruim closed 8 years ago

rpruim commented 8 years ago

image

rpruim commented 8 years ago

Here's the documentation. Any suggested improvements? Better attribution?

Births2015 {mosaicData} R Documentation US Births in 2015

Description

A day by day record of the number of births in the United States in 2015.

Usage

data(Births2015) Format

A data frame with 365 observations on the following variables.

date date in 2015

births number of US births

dayofyear sequential number of days from 1 to 365

wday day of week as an ordered factor

Source

United States Centers for Disease Control (based on 2015 US Natality data).

See Also

Births78, Births

Examples

data(Births2015) if (require(lattice)) { xyplot(births ~ date, Births2015) xyplot(births ~ date, Births2015, groups = wday) }

rpruim commented 8 years ago

Interestingly, the seasonal effect is much less pronounced in 2015. The weekend effect has grown:

Births78 %>% 
  group_by(wday) %>% summarise(births = sum(births)) %>% 
  ungroup() %>% mutate(frac = births / sum(births))
# A tibble: 7 × 3
   wday births      frac
  <ord>  <int>     <dbl>
1   Sun 421400 0.1264236
2   Mon 487309 0.1461968
3  Tues 504858 0.1514617
4   Wed 493897 0.1481733
5 Thurs 493149 0.1479489
6   Fri 500541 0.1501665
7   Sat 432085 0.1296292
Births2015 %>% 
   group_by(wday) %>% summarise(births = sum(births)) %>%
   ungroup() %>% mutate(frac = births / sum(births))
# A tibble: 7 × 3
   wday births       frac
  <ord>  <dbl>      <dbl>
1   Sun 384686 0.09669129
2   Mon 610448 0.15343684
3  Tues 654462 0.16449981
4   Wed 638513 0.16049101
5 Thurs 640422 0.16097084
6   Fri 615397 0.15468078
7   Sat 434569 0.10922944
nicholasjhorton commented 8 years ago

Acknowledging Brady Hamilton for his assistance generating the aggregated data would be a nice touch.

rpruim commented 8 years ago

I modified the documentation to this:

Source

Obtained from the United States Centers for Disease Control (based on 2015 US Natality data) with assistance from Brady Hamilton.

rpruim commented 8 years ago

Update based on email from Brady Hamilton:

Source

Obtained from the National Center for Health Statistics, National Vital Statistics System, Natality, 2015 data.