Re: [R] Spatial: number of independent components?

From: Nikhil Kaza <>
Date: Mon, 21 Jun 2010 09:48:57 -0400

I just updated spdep and I see that as.spam.listw works. Below is sessionInfo

Furthermore, it may be straightforward to condense the adjacency matrix *before* converting to graph which may help a little bit. You can profile the code and see which part needs speeding up.



a <- as.spam.listw(nb2listw(cell2nb(nrow(x),ncol(x),torus=T), style="B"))
ind <- which(x>0)
b <- a[ind, ind]
g1 <- graph.adjacency(b)
R version 2.11.1 (2010-05-31)


[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils
[5] datasets methods base
other attached packages: [1] igraph_0.5.3 spam_0.22-0 [3] spdep_0.5-11 coda_0.13-5 [5] deldir_0.0-12 maptools_0.7-34 [7] foreign_0.8-40 nlme_3.1-96 [9] MASS_7.3-6 Matrix_0.999375-39
[11] lattice_0.18-8 boot_1.2-42
[13] sp_0.9-64
loaded via a namespace (and not attached):
[1] grid_2.11.1 tools_2.11.1
Nikhil Kaza Asst. Professor, City and Regional Planning University of North Carolina ______________________________________________ mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code.
Received on Mon 21 Jun 2010 - 13:51:11 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 21 Jun 2010 - 19:20:33 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive