[R] Trying to rename spatial pts data frame slot that isn't a slot()
p.hiemstra at geo.uu.nl
Mon Aug 31 09:50:57 CEST 2009
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.
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)
> spdf <- SpatialPolygonsDataFrame(spol, data=data.frame
> +row.names=getSpPPolygonsIDSlots(spol)), match.ID = TRUE)
> writeOGR(spdf,dsn=mcp.dir,layer="All Mantas MCP", driver="ESRI
> #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().
>  "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()?
> Tim Clark
> Department of Zoology
> University of Hawaii
> R-help at r-project.org mailing list
> 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
P.O. Box 80.115
3508 TC Utrecht
Phone: +3130 274 3113 Mon-Tue
Phone: +3130 253 5773 Wed-Fri
More information about the R-help