Skip to content

Commit

Permalink
Update with 2020 data
Browse files Browse the repository at this point in the history
  • Loading branch information
ekothe committed Feb 22, 2021
1 parent 0001415 commit 9cd57a9
Show file tree
Hide file tree
Showing 11 changed files with 69,626 additions and 6 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
^README\.Rmd$
^nzbabynames\.Rproj$
^\.Rproj\.user$
^data-raw$
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ Suggests:
knitr,
rmarkdown
VignetteBuilder: knitr
Depends:
R (>= 2.10)
4 changes: 2 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ knitr::opts_chunk$set(

The nzbabynames package provides the following datasets

- `nzbabynames` This data set includes the sex and count of each first name from 1900 to 2017. The data set includes all names with more than 10 instances in any given year. Source: https://catalogue.data.govt.nz/dataset/baby-name-popularity-over-time/
- `nzbabynames` This data set includes the sex and count of each first name from 1900 to 2020. The data set includes all names with more than 10 instances in any given year. Source: https://catalogue.data.govt.nz/dataset/baby-name-popularity-over-time/

```{r print-nz-babynames}
library(nzbabynames)
Expand All @@ -29,7 +29,7 @@ head(nzbabynames)
head(maorinames)
```

- `nzbirths` Data on live births from 1935-2017. Data from 1971 includes live births by sex. *Note: Data before 1991 includes New Zealand residents and overseas visitors. Data from 1991 includes New Zealand residents only.* (Source: Stats NZ and licensed by Stats NZ for re-use under the Creative Commons Attribution 4.0 International licence.")
- `nzbirths` Data on live births from 1935-2020. Data from 1971 includes live births by sex. *Note: Data before 1991 includes New Zealand residents and overseas visitors. Data from 1991 includes New Zealand residents only.* (Source: Stats NZ and licensed by Stats NZ for re-use under the Creative Commons Attribution 4.0 International licence.")

```{r print-nzbirths}
head(nzbirths)
Expand Down
17 changes: 17 additions & 0 deletions data-raw/nzbabynames.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Baby name data -------------------------

library(dplyr, warn.conflicts = FALSE)
library(readr)
library(usethis)

nzbabynames <- read_csv("https://catalogue.data.govt.nz/dataset/01ee87cd-ecf8-44a1-ad33-b376a689e597/resource/0b0b326c-d720-480f-8f86-bf2d221c7d3f/download/baby-names-2021-01-07.csv",
col_types = cols(Sex = col_character()))

nzbabynames <- nzbabynames %>%
mutate(Sex = case_when(
Sex == "F" ~ "Female",
Sex == "M" ~ "Male"
))

write_csv(nzbabynames, "data-raw/nzbabynames.csv")
usethis::use_data(nzbabynames, overwrite = TRUE)
Loading

0 comments on commit 9cd57a9

Please sign in to comment.