I can select a single value for "ds-01" only how can i filter multiple characters at once
the value to be filtered in district_name columun : district_name=c("ds-01", "ds-02", "ds-03", ds-04")
data.shp<- shapefile("data.shp")
ds-01<- data.shp[data.shp$district_name=="ds-01", ]
is there a possible solution for this
jlacko
March 17, 2021, 1:53pm
2
Have you considered something along the lines of %in%
infix operator instead of equals ==
, e.g.
data.shp<- shapefile("data.shp")
ds_1234<- data.shp[data.shp$district_name %in% c("ds-01", "ds-02", "ds-03", "ds-04"), ]
alternatively using {dplyr} workflow
library(dplyr)
data_filtered <- data.shp %>%
filter(district_name %in% c("ds-01", "ds-02", "ds-03", "ds-04"))
system
Closed
March 24, 2021, 4:25pm
4
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.