Simple features in R (5)

class(nc)
## [1] "sf"         "tbl_df"     "tbl"        "data.frame"
class(nc_geom)
## [1] "sfc_MULTIPOLYGON" "sfc"
  • Class sf: data frame:
    • rows = simple features
    • columns = attributes and a ‘sticky’ geometry column
  • Class sfc: the geometry column, i.e. a list column. It is a list of the geometries of the simple features.
nc_geom[[8]] # eighth geometry
## MULTIPOLYGON (((-76.56251 36.34057, -76.60424 36.31498, -76.64822 36.31532, -76.68874 36.29452, -76.77664 36.35833, -76.92408 36.39244, -76.94351 36.40173, -76.95367 36.41923, -76.94577 36.45896, -76.90842 36.50428, -76.92413 36.55415, -76.92163 36.55416, -76.56358 36.55525, -76.49834 36.5039, -76.50246 36.45229, -76.46035 36.3739, -76.56251 36.34057)))
class(nc_geom[[8]])
## [1] "XY"           "MULTIPOLYGON" "sfg"
  • Class sfg: the geometry of a single feature