Introduction
choroplethr v3.0 is now available on github. You can get it by typing
# install.packages("devtools") library(devtools) install_github('arilamstein/[email protected]')
Version 1.3.0 has two new features:
- Data frame df_zip_demographics contains eight demographic statistics about each ZIP Code Tabulated Area (ZCTA) in the US. Data comes from the 2013 5-year American Community Survey (ACS).
- Function ?get_zip_demographics will return a data.frame with those same statistics from an arbitrary ACS.
Data
Here is how to access the data:
library(choroplethrZip) data(df_zip_demographics) ?df_zip_demographics colnames(df_zip_demographics) [1] "region" "total_population" "percent_white" [4] "percent_black" "percent_asian" "percent_hispanic" [7] "per_capita_income" "median_rent" "median_age" summary(df_zip_demographics[, "total_population"]) Min. 1st Qu. Median Mean 3rd Qu. Max. 0 721 2802 9517 13000 114700
Mapping the Data
Here is a program which will create national maps of the data:
# for each column in the data.frame for (i in 2:ncol(df_zip_demographics)) { # set the value and title df_zip_demographics$value = df_zip_demographics[,i] title = paste0("2013 ZCTA Demographics:n", colnames(df_zip_demographics[i])) # print the map choro = zip_choropleth(df_zip_demographics, title=title) print(choro) }
Note that national zip maps can take a few minutes to render. Here is the output.
New Vignette
Additionally, I have created a new vignette about these features.