New Package: choroplethrCaCensusTract

June 11, 2015

(This article was first published on » R, and kindly contributed to R-bloggers)

Today I am happy to announce that my newest R package, choroplethrCaCensusTract, is now available on github. The package’s title is a combination of three words:

  1. choroplethr: the package has similar functions and data objects as my package choroplethr. The name choroplethr itself is a combination of the words choropleth map and R programming language.
  2. Ca: an abbreviation of the US State of California.
  3. census Tracts are geographic units used by the US Census Bureau. Tract boundaries do not change very often and normally contain between 1,200 and 8,000 people.

The package helps you visualize data that is aggregated at the level of census tracts in California. It also helps you to work with demographic data from the US Census Bureau that is aggregated at this level.

Example: Population

# install.packages("devtools")
install_github("[email protected]", "arilamstein")



    title  = "2012 Population Estimatesn California Census Tracts",
    legend = "Population")



Because census tracts normally have less than 8,000 people, it is hard to see the tracts in urban areas on a state-wide map.  We can zoom in on individual counties by using the county_zoom parameter. county_zoom takes a vector of County FIPS Codes.

# 6075 is the FIPS code for San Francisco County
    title       = "2012 Population Estimatesn San Francisco Census Tracts",
    legend      = "Population",
    county_zoom = 6075)


I suspect that most people will wonder what the island off the west coast is. It is the Farallon Islands.

Example: Per Capita Income

choroplethrCaCensusTract ships with a data.frame, df_ca_tract_demographics, that has eight demographic variables from the 2013 5-year American Community Survey (ACS).

## [1] "region"            "total_population"  "percent_white"    
## [4] "percent_black"     "percent_asian"     "percent_hispanic" 
## [7] "per_capita_income" "median_rent"       "median_age"

df_ca_tract_demographics$value = df_ca_tract_demographics$per_capita_income
    title       = "2013 San Francisco Census Tractsn Per Capita Income",
    legend      = "Dollars",
    num_colors  = 1,
    county_zoom = 6075)


Other Data

You can get the values of the eight variables from df_ca_tract_demographics from other surveys as well. See ?get_ca_tract_demographics.

You can also map data from any table from the ACS that is available thru their API and provides data at the level of California Census Tracts. See ?ca_tract_choropleth_acs.

Need help with a software or data project? Contact me.

The post New Package: choroplethrCaCensusTract appeared first on

To leave a comment for the author, please follow the link and comment on their blog: » R. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)