tigris::shift_geometry() "Error: crs not found: is it missing?"

148 Views Asked by At

I am trying to pull the USA map with Alaska, Hawaii, and Puerto Rico all in one area. I can pull the counties map fine, but when I use shift_geometry, then I get an error, "Error: crs not found: is it missing?" Below is my code:

library(tidycensus)
library(tigris)
library(sf)
library(dplyr)

usmap <- tigris::counties() %>% 
            shift_geometry()

I tried multiple ways to solve this error. I checked if counties map have a CRS, it does.

st_crs(usmap0)

Coordinate Reference System:
  User input: 4269 
  wkt:
GEOGCS["GCS_North_American_1983",
    DATUM["North_American_Datum_1983",
        SPHEROID["GRS_1980",6378137,298.257222101]],
    PRIMEM["Greenwich",0],
    UNIT["Degree",0.017453292519943295],
    AUTHORITY["EPSG","4269"]]

I also tried to ensure CRS in the data by using, st_transform("4269") and st_set_crs("4269"). Nothing worked. I also tried to specify the geometry and crs.

I am wondering if anyone experienced this issue? Thank you for your help!

0

There are 0 best solutions below