unnest_sf.Rd
Works for multipolygon simple features (see package `sf`) only.
unnest_sf(data, ...)
data | data set |
---|---|
... | one or more columns to extract (one is tested, you're on your own with multiple) |
library(sf)#>#> Reading layer `nc' from data source `/Library/Frameworks/R.framework/Versions/3.5/Resources/library/sf/shape/nc.shp' using driver `ESRI Shapefile' #> Simple feature collection with 100 features and 14 fields #> geometry type: MULTIPOLYGON #> dimension: XY #> bbox: xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax: 36.58965 #> epsg (SRID): 4267 #> proj4string: +proj=longlat +datum=NAD27 +no_defsgnc <- unnest_sf(nc, geometry) gnc %>% ggplot(aes(x = long, y = lat, group = group)) + geom_polygon()