[R-sig-Geo] How to filter a spatial object in sf
Manuel Spínola
m@p|no|@10 @end|ng |rom gm@||@com
Wed Jun 30 16:52:50 CEST 2021
I would like to retain the information stored in a larger spatial object
for a subset of features from a smaller spatial object. I tried a
st_filter but I cannot achieve my goal.
nc = st_read(system.file("shape/nc.shp", package="sf"))
nc_smaller <- nc %>% filter(CNTY_ID %in% c(1825, 1827, 1828))
nc_filter <- st_filter(nc, nc_smaller)
The nc_smaller has 3 features, but the nc_filter ended with 8 features. I
was expecting to have on 3 features in the nc_filter.
Manuel
--
*Manuel Spínola, Ph.D.*
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
mspinola using una.cr <mspinola using una.ac.cr>
mspinola10 using gmail.com
Teléfono: (506) 8706 - 4662
Personal website: Lobito de río <https://sites.google.com/site/lobitoderio/>
Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list