title: localG get's something wrong with the IDs
body: <p>currently I am trying to do some spatial statistics. At the moment I am playing around with the local spatial statistic from Getis and Ord to indicate "hotspots" and "coldspots" of my dataset. gem$avginc is the average income for every municipality and gem.listw.20km is my spatial weights matrix.</p>
  
  <pre><code>abs &lt;- localG(gem$avginc,gem.listw.20km,zero.policy=F)
  </code></pre>
  
  <p>First Question: As result I am getting abs as something from class "localG". Can anybody explain to me how I can transform this into a normal integer or data.frame? Or where is the advantage of this class?</p>
  
  <p>So far, so good. Because I don't know another way round I transform this into a dataframe and plot it with ggplot.</p>
  
  <pre><code>a&lt;-0
  for(i in 1:2379) {a[i] &lt;- abs[i]}
  abs &lt;- as.data.frame(a)
  abs$id &lt;- gem_codes$code
  abs &lt;- left_join(abs,coords,by=c("id"="id"))
  
  ggplot(abs,aes(long,lat)) +
  geom_polygon(aes(group=id,fill=a)) +
  scale_fill_gradient(low = "white", high = "darkred") 
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/NG08B.png" rel="nofollow">localG Statistic</a></p>
  
  <p>As you can see from the plot, there are two municipalities who don't are at a position where they should be. It should be impossible to reach such a low (and therefore white-colored) value in the middle of dark red ones like the one in the plot. It look like something got mixed up, but I don't know how. I tried to use "spChk" argument in the localG function, but I didn't get it how to use it. </p>
  
  <p>I hope anyone can help!</p>