[R] R Sig-Geo group - loop for creating spatial matrix

Francesco Perugini francesco.perugini at yahoo.it
Mon Feb 1 18:34:17 CET 2016


Dear all,I want to create a routine to generate an object for different value of val: 

z <- c(1,2,3,4,5,6,7,8,9)
for (val in z) {
 neighbors.knn <- knn2nb(knearneigh(coord, val, longlat=F),
 row.names=cod_pro,sym=F)
 }
 
However, it seems it does not work. 
How to store the neighbors.knn created matrix befoire being overwritten.
In other words, I want to create multiple spatial matrix, say, for different k neighbours.
Thanks a lot for any help. 
francper


	[[alternative HTML version deleted]]



More information about the R-help mailing list