[R-sig-Geo] "txt" to "listw"

anny peng fairyland118 at gmail.com
Wed Mar 21 21:47:37 CET 2012


Dear R users,

Thank Dr. Divand for creating spdep, and thank everyone for your attention.

I attach a 30*30 matrix, which consists of 0 and 1.  The matrix is  a
"txt" file.  I would like to change this matrix into a ".listw" file
so that I can estimate spatial auto-correlation.

As a new user, I have difficulties in reading "txt" file and use the
function "mat2listw".

Below are my errors.


data1= read.fwf("30_30.txt", widths=1)


coords <- coordinates(data1)
col005 <- dnearneigh(points, 0, 1, attr(col.gal.nb, row.names = IDs))
summary(col005)
col005.w.mat <- nb2mat(col005, zero.policy=TRUE)
col005.w.b <- mat2listw(col005.w.mat)

......



Best regard
Zz
-------------- 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		


More information about the R-sig-Geo mailing list