Hi, thanks much. This works in principle. The corrected code is below: a <- nb2mat(cell2nb(nrow(x),ncol(x),torus=T), style="B") g <- delete.vertices(graph.adjacency(a), which(x!=1)-1)
plot(g) clusters(g) the $no argument of the clusters(g) function is the sought after number. However, the function is very slow, and my machine runs out of memory (1G) for a 101 by 101 matrix. Daniel -- View this message in context: http://r.789695.n4.nabble.com/Spatial-number-of-independent-components-tp2262018p2262090.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@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.