Tim Clark
2009-Aug-30 22:54 UTC
[R] Trying to rename spatial pts data frame slot that isn't a slot()
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
Paul Hiemstra
2009-Aug-31 07:50 UTC
[R] Trying to rename spatial pts data frame slot that isn't a slot()
Hi Tim, I don't know the answer to your problem, but I do know that you might consider reposting this question to the r-sig-geo mailing list. There you will find a geographically oriented audience, which will probably lead to better and faster answers. cheers, Paul Tim Clark wrote:> 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 > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +3130 274 3113 Mon-Tue Phone: +3130 253 5773 Wed-Fri http://intamap.geo.uu.nl/~paul