[R] matrix to gal object
    Roger Bivand 
    Roger.Bivand at nhh.no
       
    Sat Dec 22 14:11:04 CET 2007
    
    
  
bernardo lagos alvarez <blacertain <at> gmail.com> writes:
> 
> useR's
> 
> I need transform the matrix
> 
> wdat
>      [,1] [,2] [,3] [,4] [,5] [,6]
> [1,]    0    1    0    1    1    0
> [2,]    1    0    0    1    1    0
> [3,]    0    0    0    0    1    1
> [4,]    1    1    0    0    1    0
> [5,]    1    1    1    1    0    0
> [6,]    0    0    1    0    0    0
> 
> to  gal object. How I do with spdep?
RSiteSearch("matrix listw")
gets you to several threads on the R-sig-geo list, suggesting in your case:
w <- mat2listw(wdat)
# convert matrix to spatial weights list
write.nb.gal(w$neighbours, "wdat.gal")
# write neighbours component of spatial weights list as GAL file
Roger Bivand
> 
> Thanks in advance for the help.
> 
> Bernardo.
> University  of Concepció.
> 
> ______________________________________________
> 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.
> 
>
    
    
More information about the R-help
mailing list