r - Subset shapefile polygons based on values in a separate spreadsheet (.csv) -


i have polygon shapefile of sampling strata, contains in attributes table name/id of each respective polygon (strataid). in separate .csv file, again have same strata ids in addition sampling effort employed in each respective strata.

however, strata not sampled (sample size of 0), , grts function (spsurvey) spatial sampling not allow 0 effort, strata without effort removed; left .csv file contains strata sampling effort >0. subset of strata, need sync shapefile containing strata polygons samples allocated (i.e., strata polygons not sampled have removed shapefile).

is there way subset shapefile recalling ids present in separate spreadsheet?

both shapefile (strata) , .csv (effort) employ identical strata identifiers.

i've played around subset , other functions minimal success:

# second column of strata file strataid strata <- strata[strata@data[,2] %in% c(effort$strataid)] 

any direction appreciated.

library(maptools) data(wrld_simpl) countrydf <- data.frame(country = c('brazil', 'bolivia', 'argentina')) sampl <- wrld_simpl[wrld_simpl@data[, 5] %in% countrydf$country, ] 

or

sampl <- subset(wrld_simpl, name %in% countrydf$country)  plot(sampl, axes = t) 

plot countries


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -