I have a SpatialPolygonsDataFrame with 120 Polygons and
some associated data. Now I'd like to extract the mean of
the values on a raster within each polygon separately. I
succeded in plotting individual polygons with:
plot(SpatialPolygons(SPdataframe@polygons)[i])

But it did not work to extract the values in the same manner:
extract(raster, SpatialPolygons(SPdataframe@polygons)[i],fun="mean",na.rm=TRUE,method="simple")

Can anyone explain the difference between the use of
the same indexation in this two cases? What is the official
way to choose particular polygons of a SpatialPolygonsData-
Frame with indices?

Thank you a lot for your help in advance!


____________________________________________________

Tamara Emmenegger
Msc student
Bird migration
Tel. ++41 41 462 97 00

tamara.emmenegger@vogelwarte.ch<mailto:tamara.emmenegger@vogelwarte.ch>
www.vogelwarte.ch<http://www.vogelwarte.ch/>

Schweizerische Vogelwarte | Seerose 1 | CH-6204 Sempach | Schweiz
Station ornithologique suisse | Seerose 1 | CH-6204 Sempach | Suisse
Stazione ornitologica svizzera | Seerose 1 | CH-6204 Sempach | Svizzera
Swiss Ornithological Institute | Seerose 1 | CH-6204 Sempach | Switzerland


	[[alternative HTML version deleted]]

