ca_tract_choropleth: Create a choropleth of US Census Tracts in California

Description Usage Arguments See Also Examples

Description

Create a choropleth of US Census Tracts in California

Usage

1
2
ca_tract_choropleth(df, title = "", legend = "", num_colors = 7,
  tract_zoom = NULL, county_zoom = NULL, reference_map = FALSE)

Arguments

df

A data.frame with a column named "region" and a column named "value". Elements in the "region" column must exactly match how census tracts are labelled in in the "region" column in ?ca.tract.regions

title

An optional title for the map.

legend

An optional name for the legend.

num_colors

The number of colors on the map. A value of 1 will use a continuous scale. A value in [2, 9] will use that many colors.

tract_zoom

An optional vector of tracts to zoom in on. Elements of this vector must exactly match the names of tracts as they appear in the "region" column of ?ca.tract.regions.

county_zoom

An optional vector of county FIPS codes to zoom in on. Elements of this vector must exactly match the names of counties as they appear in the "county.fips.numeric" column of ?ca.tract.regions.

reference_map

If true, render the choropleth over a reference map from Google Maps.

See Also

https://www.census.gov/geo/reference/gtc/gtc_ct.html for more information on Census Tracts

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# zoom in on Los Angeles, which has FIPS code 6037
data(df_pop_ca_tract)
ca_tract_choropleth(df_pop_ca_tract,
                    title  = "2012 Los Angeles Census Tract\n Population Estimates",
                    legend = "Population",
                    county_zoom = 6037)                  

# add a reference map
ca_tract_choropleth(df_pop_ca_tract,
                    title  = "2012 Los Angeles Census Tract\n Population Estimates",
                    legend        = "Population",
                    county_zoom   = 6037,
                    reference_map = TRUE)                  

## Not run: 

ca_tract_choropleth(df_pop_ca_tract,
                    title  = "2012 California Census Tract\n Population Estimates",
                    legend = "Population")

# 2013 per capita income estimate
data(df_ca_tract_demographics)
df_ca_tract_demographics$value = df_ca_tract_demographics$per_capita
ca_tract_choropleth(df_ca_tract_demographics,
                    title         = "2013 Los Angeles Census Tract\n Per Capita Income",
                    legend        = "Income",
                    num_colors    = 4,
                    county_zoom   = 6037,
                    reference_map = TRUE)

## End(Not run)

arilamstein/choroplethrCaCensusTract documentation built on May 10, 2019, 1:27 p.m.