Message-ID: <5155BC3F.9080008@uni-muenster.de>
Date: 2013-03-29T16:07:27Z
From: Edzer Pebesma
Subject: extract polygon
In-Reply-To: <CD7B649F.44DD%rossahmed@gmail.com>
Ross, what you want is subsetting, not extraction.
have you tried:
newSPDF <- columbus[30,]
Reading introductory material such as
http://cran.r-project.org/web/packages/sp/vignettes/intro_sp.pdf
is also a good way to learn the first steps.
Bests,
On 03/29/2013 04:32 PM, Ross Ahmed wrote:
> Lets say I have a several polygons stored in a SpatialPolygonsDataFrame
> object. Using ?columbus? in maptools as an example:
>
> setwd(system.file("shapes", package="maptools"))
> columbus <- readShapeSpatial("columbus.shp?)
>
> I want to extract a polygon 30 from ?columbus?, and assign it to a new
> SpatialPolygonsDataFrame object. I?ve tried?
>
> newSPDF <- Polygons(list(columbus at polygons[[30]]), "29?)
>
> ?but this didn?t work. How can I do this?
>
> Thanks
> Ross
>
>
>
> [[alternative HTML version deleted]]
>
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of M?nster
Weseler Stra?e 253, 48151 M?nster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics e.pebesma at wwu.de