R apply function in turn to each subset of a spatialPolygonsDataFrame

المشرف العام

Administrator
طاقم الإدارة
I'm trying to get the area of all the polygons in a SpatialPolygonsDataFrame: parcProj.

library("rgeos")gArea(parcProj[2,])works fine but:

apply(parcProj,1,gArea)or

sapply(parcProj@polygons,gArea)don't.

Any standard way to do an apply besides the obvious:

for(i in 1:length(parcProj)) areas
 
أعلى