Subsetting simple features (1)

Based on the sf documentation:

## S3 method for class 'sf'
x[i, j, ..., drop = FALSE, op = st_intersects]
  • i: row selection (as in data frames), or a sf object to work with the op argument
  • j: column selection (as in data frames)
  • drop: default FALSE; if TRUE drop the geometry column (= return data frame)
  • op: geometrical binary predicate function to apply when i is a simple feature object

So we can subset using non-spatial criteria (row and column selection) or spatial criteria (another sf object).