The ozbabynames package provides the data object `ozbabynames` containing popular Australian baby names by sex, state/territory and year. The coverage is very uneven, with some states only providing very recent data, and some states only providing the top 50 or 100 names. The ACT do not provide counts, and so no ACT data are included. South Australia has by far the best data, with full coverage of all names from 1944-1917, although only the top 100 names thereafter.
Examples
head(ozbabynames)
#> # A tibble: 6 × 5
#> year state sex name count
#> <int> <chr> <chr> <chr> <int>
#> 1 2023 New South Wales Female Isla 403
#> 2 2023 New South Wales Female Amelia 399
#> 3 2023 New South Wales Female Olivia 381
#> 4 2023 New South Wales Female Mia 347
#> 5 2023 New South Wales Female Charlotte 338
#> 6 2023 New South Wales Female Ava 284
# Plot most popular names in 2016
library(ggplot2)
library(dplyr)
#>
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#>
#> filter, lag
#> The following objects are masked from ‘package:base’:
#>
#> intersect, setdiff, setequal, union
ozbabynames |>
filter(year == 2016) |>
group_by(sex, name) |>
summarise(count = sum(count)) |>
arrange(-count) |>
top_n(10) |>
ungroup() |>
ggplot(aes(x = reorder(name, count), y = count, group = sex)) +
geom_bar(stat = "identity") +
facet_grid(sex ~ ., scales = "free_y") +
coord_flip() +
ylab("Count") +
xlab("Name") +
ggtitle("Top ten male and female names in 2016")
#> `summarise()` has grouped output by 'sex'. You can override using the `.groups`
#> argument.
#> Selecting by count