I am getting an error in plotting the census tract of New York using tmap. Below is an example and the error.
It requires API key which is free. Here is the link - https://api.census.gov/data/key_signup.html
library(tidycensus)
library(tmap)
census_api_key("it requires API key")
NY <- get_acs(
geography = "tract",
table = "B19001",
state = "NY",
year = 2020,
geometry = TRUE,
cache_table = TRUE
)
tm_shape(shp = NY) +
tm_polygons()
I am getting an error.
Error in `$<-.data.frame`(`*tmp*`, "SHAPE_AREAS", value = c(5.02814518540036, :
replacement has 91698 rows, data has 91987
In addition: Warning message:
The shape NY contains empty units.