Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

choroplethr_wdi

Create a country-level choropleth using data from the World Bank's World Development Indicators (WDI)


Description

Create a country-level choropleth using data from the World Bank's World Development Indicators (WDI)

Usage

choroplethr_wdi(
  code = "SP.POP.TOTL",
  year = 2012,
  title = "",
  num_colors = 7,
  zoom = NULL
)

Arguments

code

The WDI code to use.

year

The year of data to use.

title

A title for the map. If not specified, automatically generated to include WDI code and year.

num_colors

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

zoom

An optional list of countries to zoom in on. Must come from the "name" column in ?country.regions.

Value

A choropleth.

References

Uses the WDI function from the WDI package by Vincent Arel-Bundock.

Examples

## Not run: 
# See http://data.worldbank.org/indicator/SP.POP.TOTL
choroplethr_wdi(code="SP.POP.TOTL", year=2012, title="2012 Population Estimates", num_colors=1)

# See http://data.worldbank.org/indicator/SP.DYN.LE00.IN 
choroplethr_wdi(code="SP.DYN.LE00.IN", year=2012, title="2012 Life Expectancy Estimates")

# See http://data.worldbank.org/indicator/NY.GDP.PCAP.CD 
choroplethr_wdi(code="NY.GDP.PCAP.CD", year=2012, title="2012 Per Capita Income") 

## End(Not run)

choroplethr

Simplify the Creation of Choropleth Maps in R

v3.7.0
BSD_3_clause + file LICENSE
Authors
Ari Lamstein [aut, cre], Brian Johnson [ctb], Trulia, Inc. [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.