If you have a SpatialPalygons called "poly" you can take polylist from this object.

> class(poly)
[1] "SpatialPolygons"
attr(,"package")
[1] "sp"
## i=1
> class(poly@polygons[[1]]@Polygons[[1]]@coords) 
[1] "matrix"
#you could use like this
> inout(cbind(yourLAT, youLONG),
                    poly@polygons[[i]]@Polygons[[1]]@coords)
### one function you could use to get the point data from pattern is.
patterndata <- t(sapply(1:399, function(i) {
  id <- which(inout(cbind(yourLAT, yourLONG),
                    poly@polygons[[i]]@Polygons[[1]]@coords))
  apply(yourpointsdata[id, ],2, mean,na.rm=TRUE)
}))

regards

 

_______________________
Gledson Luiz Picharski
PET Estatística - UFPR
http://www.leg.ufpr.br/~gledson
http://www.leg.ufpr.br/pet





________________________________
De: Jim Burke <j.burke@earthlink.net>
Para: r-sig-geo@stat.math.ethz.ch
Enviadas: Domingo, 3 de Maio de 2009 1:07:25
Assunto: Re: [R-sig-Geo] How can I convert a "SpatialPolygons" object to a "polylist"?

And using shape2poly does not work either.

>census_poly_sp <- shape2poly(census_sp, region.id = NULL)
Error in shape2poly(census_sp, region.id = NULL) :
No shp component in this list


The above file was read in (see below). Internal
measurements are in long lats. I can spplot and
make a KML file just fine for example.
census_sp <- readShapePoly("HD_102_census_blocks_sp.shp",
IDvar="BLKIDFP00", proj4string=CRS("+init=epsg:4326"))


Thanks,
Jim Burke



Jim Burke wrote:
> How can I convert a "SpatialPolygons" object to a "polylist"
> I have a file read in with "readShapePoly". This contains the polygon
> long lats in a slot called "coords". I want to use the package "splancs"
> "inout" function which works according to the doc with polygon data sets.
> An example Map2Poly which works with "inout" lists itself as a class "polylist". Thanks,
> Jim Burke
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 
> 

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo



[[elided Yahoo spam]]

	[[alternative HTML version deleted]]

