# NOT RUN {
if (require(rgdal) & require(rgeos)) {
	p <- shapefile(system.file("external/lux.shp", package="raster"))
	x <- geom(p)
	head(x)
	
# and back to a SpatialPolygonsDataFrame	
	x <- data.frame(x)
	sp <- as(x, "SpatialPolygons")
	crs(sp) <- crs(p)
	spdf <- SpatialPolygonsDataFrame(sp, data.frame(p), match.ID=FALSE)
}
# }
Run the code above in your browser using DataLab