Extract centroid of shape file object in R?
问题 I have a shape file, uploaded at the following path: https://drive.google.com/open?id=0B1ITb_7lHh1EUFVfVWc4ekRfSnc I imported the data using the "read.shapefiles" function in "shapefiles" package: landuse<- read.shapefile("landuse") I now need to extract the lat/long centroids of all the shapes within the landuse object and add it to the landuse$dbf dataframe I tried two things: lu_df<-coordinates(landuse) lu_df<-SpatialPoints(landuse) Both gave me the following error: Error in coordinates(as