(This is my first attempt to use R, so I apologize for any stupidity. Also, please let me know if this is better posted in Stack Overflow.)
I'm trying to use the Microsoft building footprint dataset to make a map of buildings in my city (Cambridge, MA). I'm following this gist as a guide. These lines of code are giving me problems:
options(tigris_class = "sf", tigris_use_cache = TRUE)
zctas_national <- zctas(cb = TRUE)
selected_zip <- zctas_national %>%
filter(ZCTA5CE10 %in% c(02139))
When I try to print(selected_zip)
, I get nothing back. Or rather, I get a table that looks like this:
[1] ZCTA5CE10 AFFGEOID10 GEOID10 ALAND10 AWATER10 geometry
<0 rows> (or 0-length row.names)
If I replace 02139 with 85308 (the zip from the gist), everything is fine:
ZCTA5CE10 AFFGEOID10 GEOID10 ALAND10 AWATER10
1 85308 8600000US85308 85308 44254346 872904
Anyone know what's going on?