choroplethr: Simplify the Creation of Choropleth Maps in R

塗り分け地図

> library(choroplethr)

バージョン: 3.1.0


関数名 概略
Admin1Choropleth An R6 object for creating Administration Level 1 choropleths.
Choropleth The base Choropleth object.
CountryChoropleth An R6 object for creating country-level choropleths.
CountyChoropleth Create a county-level choropleth
CountyZoomChoropleth Create a county-level choropleth that zooms on counties, not states.
StateChoropleth Create a state-level choropleth
USAChoropleth Normal choropleth that draws Alaska and Hawaii as insets. In addition to a columns named "region" and "value", also requires a column named "state".
admin1_choropleth Create an admin1-level choropleth for a specified country
choroplethr Create a choropleth
choroplethr_acs Create a choropleth from ACS data.
choroplethr_animate Animate a list of choropleths
choroplethr_wdi Create a country-level choropleth using data from the World Bank's World Development Indicators (WDI)
country_choropleth Create a country-level choropleth
county_choropleth Create a choropleth of US Counties
county_choropleth_acs Create a US County choropleth from ACS data
county_zoom_choropleth Create a choropleth of USA Counties, with sensible defaults, that zooms on counties.
df_county_demographics A data.frame containing demographic statistics for each county in the United States.
df_japan_census A data.frame containing basic demographic information about Japan.
df_pop_country A data.frame containing population estimates for Countries in 2012.
df_pop_county A data.frame containing population estimates for US Counties in 2012.
df_pop_state A data.frame containing population estimates for US States in 2012.
df_president A data.frame containing election results from the 2012 US Presidential election.
df_president_ts A data.frame containing all US presdiential election results from 1789 to 2012
df_state_demographics A data.frame containing demographic statistics for each state plus the District of Columbia.
get_acs_data Returns a list representing American Community Survey (ACS) estimates
get_acs_df Returns a data.frame representing US Census American Community Survey (ACS) estimates.
get_county_demographics Get a handful of demographic variables on US Counties from the US Census Bureau as a data.frame.
get_state_demographics Get a handful of demographic variables on US States from the US Census Bureau as a data.frame.
state_choropleth Create a choropleth of US States
state_choropleth_acs Create a US State choropleth from ACS data
zip_map Create a map visualizing US ZIP codes with sensible defaults

admin1_choropleth

行政区画の塗り分け図

Arguments

  • country.name
  • df
  • title
  • legend
  • num_colors
  • zoom
> data("df_japan_census")
> df_japan_census$value <- df_japan_census$pop_2010
> 
> admin1_choropleth(country.name = "japan",
+                   df           = df_japan_census,
+                   title        = "2010 Japan Population Estimates",
+                   legend       = "Population") + scale_fill_brewer(palette=2)

country_choropleth

世界の国地図

> data("df_pop_country")
> country_choropleth(df         = df_pop_country,
+                    title      = "2012 World Bank Population Estimates",
+                    num_colors = 1,
+                    zoom       = c("united states of america", "canada", "mexico"))

county_choropleth

アメリカ合衆国の州地図

Arguments

  • df... データフレーム
  • title
  • legend
  • num_colors
  • state_zoom... 州を指定してズーム
  • county_zoom
> data("df_pop_county")
> county_choropleth(df        = df_pop_county,
+                  title      = "US 2012 County Population Estimates",
+                  legend     = "Population",
+                  num_colors = 1,
+                  state_zoom = c("california", "oregon", "washington"))

df_pop_country

2012年時での世界国別人口データ

> data("df_pop_country")
> head(df_pop_country)
                region    value
1 united arab emirates  9205651
2          afghanistan 29824536
3              albania  2801681
4              armenia  2969081
5               angola 20820525
6            argentina 41086927

df_pop_state

アメリカの州ごとの2012年推定人口数データ

> data("df_pop_state")
> head(df_pop_state)
      region    value
1    alabama  4777326
2     alaska   711139
3    arizona  6410979
4   arkansas  2916372
5 california 37325068
6   colorado  5042853

df_japan_census

日本の人口動態データ

> data("df_japan_census")
> head(df_japan_census)
   region pop_2010 percent_pop_change_2005_2010 pop_density_km2_2010
23  aichi  7411000                          2.2               1434.8
5   akita  1086000                         -5.2                 93.3
2  aomori  1373000                         -4.4                142.4
12  chiba  6216000                          2.6               1205.5
38  ehime  1431000                         -2.5                252.1
18  fukui   806000                         -1.9                192.4

state_choropleth

アメリカ合衆国の塗り分け地図を描画

> state_choropleth(df_pop_state)