This package provides a single dataset of censal and intercensal population estimates for the United States by year of age and sex, for every year from 1900 to 2019.

Installation

uscenpops is a data package.

Install direct from GitHub

You can install the beta version of uscenpops from GitHub with:

Installation using drat

While using install_github() works just fine, it would be nicer to be able to just type install.packages("uscenpops") or update.packages("uscenpops") in the ordinary way. We can do this using Dirk Eddelbuettel’s drat package. Drat provides a convenient way to make R aware of package repositories other than CRAN.

First, install drat:

if (!require("drat")) {
    install.packages("drat")
    library("drat")
}

Then use drat to tell R about the repository where uscenpops is hosted:

You can now install uscenpops:

install.packages("uscenpops")

To ensure that the uscenpops repository is always available, you can add the following line to your .Rprofile or .Rprofile.site file:

With that in place you’ll be able to do install.packages("uscenpops") or update.packages("uscenpops") and have everything work as you’d expect.

Note that the drat repository only contains data packages that are not on CRAN, so you will never be in danger of grabbing the wrong version of any other package.

Example

plot of chunk example-2

Source

The data are sourced from the US Census Bureau, from the residential estimates available in various formats and spans at https://www2.census.gov/programs-surveys/popest/tables/. In any year where multiple months were available, the July estimate was used.

Similar Packages

  • Neal Grantham’s uspops contains total annual population estimates from 1900 to 2018 as well as state total annual estimates over the same period.