Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ docs/
.RData
*.xls
docs

## get rid of check log
..Rcheck/
15 changes: 11 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
Package: babynames
Title: US Baby Names 1880-2017
Version: 1.0.1
Title: US Baby Names 1880-2020
Version: 1.1.1
Authors@R:
c(person(given = "Hadley",
family = "Wickham",
role = c("aut", "cre"),
email = "hadley@rstudio.com"),
person(given = "RStudio",
role = "cph"))
role = "cph"),
person(
given = "Francis",
middle = "Robert",
family = "Kovacs",
role = c("ctb"),
email = "frankkovacs8@gmail.com"
))
Description: US baby names provided by the SSA. This package contains all
names used for at least 5 children of either sex.
License: CC0
Expand All @@ -22,5 +29,5 @@ Suggests:
Encoding: UTF-8
LazyData: true
LazyDataCompression: xz
RoxygenNote: 7.1.1
RoxygenNote: 7.1.2
Config/testthat/edition: 3
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# babynames 1.1.1

* Updated data up to and including 2020
* Removed depreciated code in `data-raw` scripts
* Minor updates to old data caused by re-running `data-raw` scripts

# babynames 1.0.1

* Fix for R CMD check change
Expand Down
2 changes: 1 addition & 1 deletion R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ NULL
#' @format A data frame:
#' \describe{
#' \item{year}{Year}
#' \item{births}{Number of live births, rounded to nearest 1000}}
#' \item{births}{Number of live births, rounded to nearest 1000 for all years prior to 1959}}
"births"
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

This package contains three datasets provided by the USA social security administration:

* `babynames`: For each year from 1880 to 2017, the number of children of
* `babynames`: For each year from 1880 to 2020, the number of children of
each sex given each name. All names with more than 5 uses are given.
(Source: http://www.ssa.gov/oact/babynames/limits.html)

Expand All @@ -18,9 +18,12 @@ This package contains three datasets provided by the USA social security adminis

It also includes the following data set from the US Census:

* `births`: Number of live births by year, up to 2017.
* `births`: Number of live births by year, up to 2020.
(Source: an Excel spreadsheet from the Census that has since been removed
from their website and https://www.cdc.gov/nchs/data/nvsr/nvsr66/nvsr66_01.pdf)
from their website and https://www.cdc.gov/nchs/data/nvsr/nvsr66/nvsr66_01.pdf.
Data for 2017-2020 obtained from https://www.cdc.gov/nchs/data/nvsr/nvsr68/nvsr68_13-508.pdf,
https://www.cdc.gov/nchs/data/nvsr/nvsr70/nvsr70-02-508.pdf and
https://www.cdc.gov/nchs/data/nvsr/nvsr70/nvsr70-17.pdf.)

## Installation

Expand Down
7 changes: 4 additions & 3 deletions data-raw/applicants.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ library(usethis)

page <- read_html("https://www.ssa.gov/oact/babynames/numberUSbirths.html")

ssa <- page %>% html_nodes("table") %>% .[[2]] %>% html_table() %>% tbl_df()

ssa <- page %>% html_nodes("table") %>% .[[1]] %>% html_table() %>% tibble::as_tibble()
names(ssa) <- c("year", "M", "F", "total")
ssa$total <- NULL

ssa$M <- parse_number(ssa$M)
ssa$F <- parse_number(ssa$F)
ssa$M <- readr::parse_number(ssa$M)
ssa$F <- readr::parse_number(ssa$F)

applicants <- ssa %>%
gather(sex, n_all, M:F) %>%
Expand Down
Loading