标签: tidycensus

tidycensus :: get_acs()地理选项?

tidycensus :: get_acs(geography = ???)中地理参数的可能级别/选项有哪些?

我看到它的工作原理如下:

library(tidycensus)
census_api_key("YOUR API KEY GOES HERE")

vt <- get_acs(geography = "county", 
              variables = "B19013_001", 
              state = "VT")

slc_value <- get_acs(geography = "tract", 
                variables = "B25077_001", 
                state = "UT",
                county = "Salt Lake County",
                geometry = TRUE)

states <- get_acs(geography = "state", 
              variables = "B19013_001")
Run Code Online (Sandbox Code Playgroud)

是否所有人口普查地理实体都可用?(https://www2.census.gov/geo/pdfs/reference/geodiagram.pdf)

如果是这样,我如何指定国家或邮政编码?此代码不起作用:

nation <- get_acs(geography = "nation", 
              variables = "B19013_001")
Run Code Online (Sandbox Code Playgroud)

r tidycensus

5
推荐指数
2
解决办法
1623
查看次数

为什么 geom_sf 不允许填充数据框中的离散列?

我使用 绘制了一个空间地图,但是只要参数位于其中,geom_sf它就会不断地为我的参数拾取连续比例,但是当我将其取出并填充时,它也不起作用,它会覆盖我的手动颜色,而图例不会展示。我尝试传入内部层,但这会导致错误:fillaesscale_fill_manualfillaesas.factors

错误:提供给连续刻度的离散值

但这些价值观是谨慎的!所以我必须把它变成数字。new_file.csv可以在此处找到可重现的示例和数据文件:

https://github.com/THsTestingGround/SO_question_fill_map/blob/master/new_file.csv

代码:

options(scipen = 9999,tigris_use_cache = TRUE)
library(sf)
library(tidyverse)
library(tidycensus)
library(RCurl)
library(tigris)

#Took out my census api key because of a feed back from a SO member. Please add a comment
#if you would like my census key.

url <- getURL("https://raw.githubusercontent.com/THsTestingGround/SO_question_fill_map/master/new_file.csv")

#read the csv file
gainsville_df <- read_csv(url) #store the csv file content from my github link

#get the population geomtry shapefiles
alachua <- tidycensus::get_acs(state = …
Run Code Online (Sandbox Code Playgroud)

r geospatial ggplot2 r-sf tidycensus

4
推荐指数
1
解决办法
7497
查看次数

标签 统计

r ×2

tidycensus ×2

geospatial ×1

ggplot2 ×1

r-sf ×1