admin1_choropleth: Create an admin1-level choropleth for a specified country

Description Usage Arguments Examples

Description

The map used comes from ?admin1.map in the choroplethrAdmin1 package. See ?get_admin_countries and ?get_admin_regions in the choroplethrAdmin1 package for help with the spelling of regions.

Usage

1
2
admin1_choropleth(country.name, df, title = "", legend = "", buckets = 7,
  zoom = NULL)

Arguments

country.name

The name of the country. Must exactly match how the country is named in the "country" column of ?admin1.regions in the choroplethrAdmin1 package.

df

A data.frame with a column named "region" and a column named "value". Elements in the "region" column must exactly match how regions are named in the "region" column in ?admin1.regions in the choroplethrAdmin1 package

title

An optional title for the map.

legend

An optional name for the legend.

buckets

The number of equally sized buckets to places the values in. A value of 1 will use a continuous scale, and a value in [2, 9] will use that many buckets.

zoom

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Not run: 

data(df_japan_census)
head(df_japan_census)
# set the value we want to map to be the 2010 population estimates
df_japan_census$value=df_japan_census$pop_2010

# default map of all of japan
admin1_choropleth("japan",
                   df_japan_census,
                   "2010 Japan Population Estimates",
                   "Population")

# zoom in on the Kansai region and use a continuous scale
kansai = c("mie", "nara", "wakayama", "kyoto", "osaka", "hyogo", "shiga")
admin1_choropleth("japan",
                   df_japan_census,
                   "2010 Japan Population Estimates",
                   "Population",
                   1,
                   kansai)

## End(Not run)

trulia/choroplethr documentation built on June 1, 2019, 1:52 a.m.