| uspop2 | R Documentation |
US population by age and sex, for 2000 through 2020
uspop2
The data is a matrix with dimensions age, sex, and calendar year. Age goes from 0 through 100, where the value for age 100 is the total for all ages of 100 or greater.
This data is often used as a "standardized" population for epidemiology studies.
The usage above assumes that the survival package is attached via
library(survival) or via another package that depends on
survival, e.g., mstate. If not, then either survival::uspop2
can be used or data(survexp, package="survival").
NP2008_D1: Projected Population by Single Year of Age, Sex, Race, and Hispanic Origin for the United States: July 1, 2000 to July 1, 2050, www.census.gov/population/projections.
uspop
us50 <- uspop2[51:101,, "2000"] #US 2000 population, 50 and over
age <- as.integer(dimnames(us50)[[1]])
smat <- model.matrix( ~ factor(floor(age/5)) -1)
ustot <- t(smat) %*% us50 #totals by 5 year age groups
temp <- c(50,55, 60, 65, 70, 75, 80, 85, 90, 95)
dimnames(ustot) <- list(c(paste(temp, temp+4, sep="-"), "100+"),
c("male", "female"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.