[R-sig-Geo] Error in print(data.frame) & zero.policy

Zz fairyland118 at gmail.com
Sun Apr 8 23:15:40 CEST 2012


Dear spdep users,



I tried to follow below command to create a neighborhood list.   The
data "Matrix.txt"
is enclosed


> mat0 <- read.table("Matrix.txt", header=FALSE, sep="\t", fill=TRUE)
> mat <- as.matrix(mat0)
> dim(mat)
[1] 46 46
> summary(c(mat))
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's
      1       1       1       1       1       1    1918
> mat[is.na(mat)] <- 0
> summary(c(mat))
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
0.00000 0.00000 0.00000 0.09357 0.00000 1.00000
> lw <- mat2listw(mat, style="B")
Warning message:
In nb2listw(res$neighbours, glist = res$weights, style = style,  :
  zero sum general weights
> summary(lw)
Characteristics of weights list object:
Neighbour list object:
Number of regions: 46
Number of nonzero links: 198
Percentage nonzero weights: 9.357278
Average number of links: 4.304348
2 regions with no links:
2 18
Link number distribution:

 0  2  3  4  5  6  7  8
 2  5  5 14  8  9  1  2
5 least connected regions:
7 8 9 36 41 with 2 links
2 most connected regions:
24 38 with 8 links

Weights style: B
Weights constants summary:
Error in print(data.frame(rbind(unlist(spweights.constants(object,
zero.policy = zero.policy))[c(1,  :
  error in evaluating the argument 'x' in selecting a method for function
'print': Error in spweights.constants(object, zero.policy = zero.policy) :
  regions with no neighbours found
> is.symmetric.nb(lw$neighbours)
[1] TRUE



The neighborhood list cannot be used in spatial regression.    The main
error seems to be "Error in
print(data.frame(rbind(unlist(spweights.constants(object, zero.policy =
zero.policy))[c(1,  :
  error in evaluating the argument 'x' in selecting a method for function
'print': Error in spweights.constants(object, zero.policy = zero.policy) :
  regions with no neighbours found"


Is there anyone know what wrong with the data?  Thanks




Happy Easter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20120408/7c2fbc14/attachment.html>
-------------- next part --------------
								1	1													1															1								
																																													
				1																						1	1												1						
																1						1	1									1					1	1							
		1																								1							1												
														1											1		1					1							1						1
																			1									1																	
																		1																								1			
1									1																																				
1								1																					1						1		1								
																								1		1							1						1			1			1
												1	1		1					1			1																					1	
											1				1					1											1														
											1										1		1		1											1								1	
					1																		1		1							1													
											1	1											1								1						1				1		1		
			1																			1																1							
																																													
							1																											1							1		1		
						1																						1												1					
											1	1									1										1													1	
													1							1										1						1								1	
1			1													1																					1								
			1								1		1	1	1										1							1					1								
										1																				1						1									1
					1								1	1									1													1									1
		1		1						1																							1						1						
		1			1																											1						1							
						1													1															1						1					
									1																										1		1				1				
																					1			1												1									
												1			1					1														1									1		
			1		1									1									1				1											1							
				1						1																1																1			
																		1										1			1												1		
									1																				1																
													1								1			1	1					1															1
1			1						1						1							1	1						1												1				
			1													1											1					1													
		1			1					1																1																			1
																			1									1																	
															1			1											1								1						1		
							1			1																							1												
															1			1													1			1							1				
											1		1							1	1																								
					1					1														1	1											1			1						


More information about the R-sig-Geo mailing list