楼主: oliyiyi
91828 2410

【latex版】水贴   [推广有奖]

841
oliyiyi 发表于 2015-9-9 16:36:11

缺少币币的网友请访问有奖回帖集合
https://bbs.pinggu.org/thread-3990750-1-1.html

842
oliyiyi 发表于 2015-9-9 16:36:43
Exercise: Map the Population of US States in 2010.

843
oliyiyi 发表于 2015-9-9 16:37:20
In lesson 2 we used two objects to analyze state demographics:


?df_pop_state, which has data from the 2012 5-year America Community Survey (ACS)
?df_state_demographics, which has data from the 2013 5-year ACS
To get data from other years you need to access the US Census API. To do that:

Fill out this form to get a Census API Key. They will email you a key.
When you get your key, type the following in R:

844
oliyiyi 发表于 2015-9-9 16:37:54
To get data from other years you need to access the US Census API. To do that:

Fill out this form to get a Census API Key. They will email you a key.
When you get your key, type the following in R:

845
oliyiyi 发表于 2015-9-9 16:38:34
  1. library(acs)

  2. api.key.install("<your key>")
复制代码

846
oliyiyi 发表于 2015-9-9 16:39:17
  1. library(choroplethr)

  2. ?get_state_demographics
  3. df_2010_demographics = get_state_demographics(2010)
复制代码

847
oliyiyi 发表于 2015-9-9 16:40:26
Creating a map of 2010 population estimates is now simple:



  1. df_2010_demographics$value =
  2.     df_2010_demographics$total_population

  3. state_choropleth(df_2010_demographics,
  4.     title = “2010 State Population Estimates”,
  5.     legend = “Population”)
复制代码

848
oliyiyi 发表于 2015-9-9 16:41:01

Creating a map of 2010 population estimates is now simple:


df_2010_demographics$value =     df_2010_demographics$total_populationstate_choropleth(df_2010_demographics,    title = “2010 State Population Estimates”,     legend = “Population”)
缺少币币的网友请访问有奖回帖集合
https://bbs.pinggu.org/thread-3990750-1-1.html

849
oliyiyi 发表于 2015-9-9 16:41:35

缺少币币的网友请访问有奖回帖集合
https://bbs.pinggu.org/thread-3990750-1-1.html

850
oliyiyi 发表于 2015-9-9 16:42:18
Exercise: Make a map showing the Percent Hispanic of Counties in Texas in 2011.



We will get the data with the function ?get_county_demographics, which works analogously to get_state_demographics:

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-3-1 17:55