R的Choroplethr v3.6.0中的tract_choropleth [英] tract_choropleth in Choroplethr v3.6.0 for R

查看:126
本文介绍了R的Choroplethr v3.6.0中的tract_choropleth的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试复制此简短示例中显示的地图( Choroplethr v3.6.0现在已在加利福尼亚州的CRAN )上使用,但在纽约以外的地区,我无法使用 tract_choropleth 函数.我收到以下错误消息.我能够导入所有区域的基础区域数据,但是在映射非纽约地区的数据时遇到了麻烦.预先感谢.

I'm trying to replicate the maps shown in this short example (Choroplethr v3.6.0 is now on CRAN) for California, but I'm having trouble with the tract_choropleth function for areas that are not in NY. I get the error message below. I'm able to import the underlying tract data for all areas, but I'm having trouble mapping the non-NY ones. Thanks in advance.

 # Load all packages (DONE)
 # Install api key (DONE)

 # Get Tract-Level Demographics 
    ca_stats = get_tract_demographics("california")

 # Create choropleth map with the function tract_choropleth
    ca_stats$value = ca_stats$per_capita_income
    tract_choropleth(ca_stats, "california", title = "2013 Per Capita Income\nCensus Tracts", legend="Dollars")

返回错误消息:

ogrInfo中的错误(dsn = dsn,layer =层,encoding =编码, use_iconv = use_iconv ,:无法打开图层另外:警告 消息:在解压缩中(file_loc,exdir = cache_dir,overwrite = TRUE):
从zip文件中提取错误1

Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv, : Cannot open layer In addition: Warning message: In unzip(file_loc, exdir = cache_dir, overwrite = TRUE) :
error 1 in extracting from zip file

推荐答案

我是chorisplethr用于获取人口普查区域边界的tigris软件包的作者.从人口普查局网站下载的文件损坏时,将显示该错误. Ari的解决方案将起作用;您也可以尝试:

I'm the author of the tigris package that choroplethr uses to get Census tract boundaries. That error shows up in the event of a corrupted download from the Census Bureau website. Ari's solution will work; you can also try:

library(tigris)
options(tigris_refresh = TRUE)

这将指示tigris从人口普查局网站重新下载shapefile,并允许您仍然使用缓存.修复后,将options(tigris_refresh = FALSE)设置为控制将来的重新下载.

This will direct tigris to re-download the shapefile from the Census Bureau website, and allow you to still use caching. Once it is fixed, set options(tigris_refresh = FALSE) to control future re-downloads.

这篇关于R的Choroplethr v3.6.0中的tract_choropleth的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆