|
Re: Regression analysis: how to convert shapefiles to listw-objects?: msg#00002lang.r.geo
On Tue, 2 May 2006, Anja Matatko wrote: > Roger and list, > > thanks for your help with importing my shapefiles. > > As I don't want to use only the lm() command for regression analysis but > also more complex ones as lm.morantest() and others, it seems that I > need a listw-object instead of my shapefile. > > What I think I should do is: > - create polylist or Spatial Polygons > - use poly2nb() > - use nb2listw () > > My results: > > abo_object_neu <- readShapePoly ("abo_poly", > proj4string=CRS(as.character (NA)), verbose=FALSE) > > summary(abo_object_neu) > Object of class SpatialPolygonsDataFrame > Coordinates: > min max > r1 2508089 2644341 > r2 5442170 5640160 > Is projected: NA > proj4string : [NA] > Data attributes: (several attributes, I deleted them here) > > > I thought "SpatialPolygonsDataFrame" should be one of these > "SpatialPolygon"-objects to serve as input for poly2nb, but trying this > function, the answer was: > > > abo_nb <- poly2nb(abo_object_neu, row.names=NULL, > snap=sqrt(.Machine$double.eps), queen=TRUE) > Error in poly2nb(abo_object_neu, row.names = NULL, snap = > sqrt(.Machine$double.eps), : > Not a polygon list I'll correct this in the next release, you need to cast the object explicitly: abo_nb <- poly2nb(as(abo_object_neu, "SpatialPolygons")) should do the trick. Roger > > > My question: what is going wrong, are there other functions to do this > conversion from shapefile to listw-object? Is there a direct shapefile > to listw-conversion-function? I really tried to find it in help files, > but had no success. > > Thanks, Anja > > > sessionInfo() > Version 2.3.0 (2006-04-24) > i386-pc-mingw32 > > attached base packages: > [1] "methods" "stats" "graphics" "grDevices" "utils" > "datasets" "base" > > other attached packages: > spdep boot SparseM maptools sp foreign tripack PK > "0.3-22" "1.2-24" "0.68" "0.5-11" "0.8-14" "0.8-15" "1.2-10" "0.03" > > _______________________________________________ > R-sig-Geo mailing list > R-sig-Geo@xxxxxxxxxxxxxxxxx > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand@xxxxxx
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Regression analysis: how to convert shapefiles to listw-objects?, Anja Matatko |
|---|---|
| Next by Date: | write.asciigrid, Zev Ross |
| Previous by Thread: | Regression analysis: how to convert shapefiles to listw-objects?, Anja Matatko |
| Next by Thread: | write.asciigrid, Zev Ross |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |