[R] Trying to rename spatial pts data frame slot that isn't a slot()
Tim Clark
mudiver1200 at yahoo.com
Mon Aug 31 00:54:08 CEST 2009
Dear List,
I am analyzing the home range area of fish and seem to have lost the individuals ID names during my manipulations, and can't find out how to rename them. I calculated the MCP of the fish using mcp() in Adehabitat. MCP's were converted to spatial points data frame and exported to qGIS for manipulations. At this point the ID names were lost. I brought the manipulated shapefiles back into qGIS, but can't figure out how to rename the individuals.
#Calculate MCP and save as a shapefile
my.mcp<-mcp(xy, id=id, percent=100)
spol<-area2spol(my.mcp)
spdf <- SpatialPolygonsDataFrame(spol, data=data.frame
+(getSpPPolygonsLabptSlots(spol),
+row.names=getSpPPolygonsIDSlots(spol)), match.ID = TRUE)
writeOGR(spdf,dsn=mcp.dir,layer="All Mantas MCP", driver="ESRI
+Shapefile")
#Read shapefile manipulated in qGIS
mymcp<-readOGR(dsn=mcp.dir,layer="All mantas MCP land differenc")
My spatial points data frame has a number of "Slot"s, including one that contained the original names called Slot "ID". However, I can not access this slot using slot() or slotNames().
> slotNames(mymcp)
[1] "data" "polygons" "plotOrder" "bbox" "proj4string"
What am I missing here? Is Slot "ID" not a slot? Can I export the ID's with the shapefiles to qGIS? Can I rename the ID's when I bring them back into R? When is a slot not a slot()?
Thanks,
TIm
Tim Clark
Department of Zoology
University of Hawaii
More information about the R-help
mailing list