I have a spatialpolygonsdataframe
of the state of Iowa called Iowa.sp
, which contains 99 polygons. I'm trying to extract all of the labpt
values from each polygon as these are the centroids of each county in Iowa and I need to work with those values as references.
I can get an individual value for labpt
from one polygon within the data frame using this:
Iowa.sp@polygons[[1]]@labpt
But have not been able to figure out how to extract the entire list of labpt
values and am struggling with how to work within the spatialpolygonsdataframe
. Any help is much appreciated.