[R] Iterate in a Spatial Polygon Dataframe in R?

Ashraf Afana asafaneh at yahoo.com
Wed Oct 11 13:55:35 CEST 2017


Hi all,

 I'm trying to iterate in a SpatialPolygonDataFrame thatcontains 110 features. I tried to use the following code 
iterate.spdf =function(x){ for (i in 1:nrow(x)){ p = x[i, ]} return(p)}
but with no success as it returns with aSpatialPolygonDataFrame that contains onlyone feature. The code seems to overwrite the polygons to end up with only onefeature.
 Any suggestions?Ashraf, cheers


	[[alternative HTML version deleted]]



More information about the R-help mailing list