Hi,
For about a month I have been having to use my roommate's computer because I can't access acs data with geometry = TRUE. I think there is a problem with tigris. I have the following tigris code:
library(tigris)
#you need to let R know to bring in the spatial data as sf objects
options(tigris_class = "sf")
options(tigris_use_cache = TRUE)l
The error I get changes on my Mac, but works smoothly on my roommate's Windows computer. Here is the error:
Getting data from the 2015-2019 5-year ACS
Using FIPS code '06' for state 'CA'
Using FIPS code '001' for 'Alameda County'
Error: Download failed; check your internet connection or the status of the Census Bureau website
at http://www2.census.gov/geo/tiger/ .
Yesterday the error said there was a problem in my private/var folder in the Mac library. I called Apple and they said there is nothing wrong with the software, which I didn't think there was.
Not enough to troubleshoot. Consider using the tidycensus
package, which also uses simple feature (sf
) representations of ARC data.
suppressPackageStartupMessages({
library(dplyr)
library(ggplot2)
library(tidycensus)
})
library(viridis)
#> Loading required package: viridisLite
#>
#> Attaching package: 'viridis'
#> The following object is masked from 'package:viridisLite':
#>
#> viridis.map
vars10 <- c("P005003", "P005004", "P005006", "P004003")
il <- get_decennial(geography = "county", variables = vars10, year = 2010,
summary_var = "P001001", state = "CA", geometry = TRUE) %>%
mutate(pct = 100 * (value / summary_value))
#> Getting data from the 2010 decennial Census
#> Downloading feature geometry from the Census website. To cache shapefiles for use in future sessions, set `options(tigris_use_cache = TRUE)`.
#> Using Census Summary File 1
#> | | | 0% | | | 1% | |= | 1% | |= | 2% | |== | 3% | |=== | 4% | |=== | 5% | |==== | 5% | |==== | 6% | |====== | 9% | |======= | 10% | |======== | 11% | |======== | 12% | |========= | 12% | |========== | 14% | |========== | 15% | |=========== | 15% | |=========== | 16% | |============ | 17% | |============= | 19% | |============== | 20% | |============== | 21% | |=============== | 21% | |================ | 23% | |================= | 24% | |================== | 26% | |=================== | 27% | |=================== | 28% | |==================== | 28% | |==================== | 29% | |===================== | 29% | |===================== | 30% | |========================= | 36% | |========================== | 37% | |=============================== | 44% | |=============================== | 45% | |================================ | 45% | |================================ | 46% | |================================= | 46% | |================================= | 47% | |================================== | 49% | |=================================== | 49% | |=================================== | 50% | |====================================== | 55% | |======================================= | 55% | |======================================= | 56% | |======================================== | 57% | |======================================== | 58% | |========================================== | 61% | |============================================= | 64% | |============================================= | 65% | |============================================== | 65% | |============================================== | 66% | |=============================================== | 66% | |==================================================== | 75% | |===================================================== | 75% | |===================================================== | 76% | |====================================================== | 77% | |========================================================= | 82% | |========================================================== | 82% | |========================================================== | 83% | |============================================================== | 89% | |=============================================================== | 89% | |=============================================================== | 90% | |===================================================================== | 99% | |======================================================================| 100%
ggplot(il, aes(fill = pct, color = pct)) +
geom_sf() +
facet_wrap(~variable)
system
Closed
May 6, 2021, 2:13am
3
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.