Hello, I have India district shape file with 591 districts. However I have gini variable data for 393 districts for the year 2014 only in my csv file with remaining 198 districts as NA values. I have tried to merge these two files as I want to compute global Moran's statistic on my gini variable using queen contiguity. The following is my code:
## Gini data in csv file of 393 districts for the year 2014 ##
## Read India District shape file in R ##
Shape11<-readOGR(dsn = "C:\Users\USER\OneDrive\Desktop\IndiaShape", layer = "IND_adm5")
## Merging shape file with csv file ##
GiniMerged2014<-merge(Shape11, Gini2014, by = 'ID_2')
GiniMerged2014 = GiniMerged2014[!is.na(GiniMerged2014$GINI),]
queen.w<-poly2nb(GiniMerged2014, row.names = GiniMerged2014$ID_2, queen = TRUE)
queen.w1<-nb2listw(queen.w, style = "W", zero.policy = TRUE)
*# Calculate Global Moran's I for Gini 2014 and 999-Permutation based inference ##
GlobalMI.q<-moran.mc(GiniMerged2014$GINI, listw = nb2listw(queen.w), nsim = 999, alternative="two.sided")
But it is showing error:
Error in nb2listw(queen.w) : Empty neighbour sets found.
Please help me out with how to address this problem.