Skip to content
Prev 26686 / 29559 Next

How to find all first order neighbors of a collection of points

On Fri, 13 Jul 2018, Facundo Mu?oz wrote:

            
Thanks, the main source of confusion is that "first order neighbors" are 
not defined. A k=1 neighbour could be (as below), as could k=6, or voronoi 
neighbours, or sphere of influence etc. So reading vignette("nb") would be 
a starting point.

Also note that voronoi and other graph-based neighbours should only use 
planar coordinates - including dismo::voronoi, which uses deldir::deldir() 
- just like spdep::tri2nb(). Triangulation can lead to spurious neighbours 
on the convex hull.
Using individual voter data is highly dangerous, and must in every case be 
subject to the strictest privacy rules. Voter data does not in essence 
have position - the only valid voting data that has position is of the 
voting station/precinct, and those data are aggregated to preserve 
anonymity.

Why does position and voter data not have position? Which location should 
you use - residence, workplace, what? What are these locations proxying? 
Nothing valid can be drawn from "just voter data" - you can get 
conclusions from carefully constructed stratified exit polls, but there 
the key gender/age/ethnicity/social class/etc. confounders are handled by 
design. Why should voting decisions be influenced by proximity (they are 
not)? The missing element here is looking carefully at relevant covariates 
at more aggregated levels (in the US typically zoning controlling social 
class positional segregation, etc.).
You mean RStudio, there is no such version of R.
These are in geographical coordinates.
jitter does not respect geographical coordinated (decimal degree metric).
See the help page (hint: longlat=TRUE to use Great Circle distances, much 
slower than planar).
Plain text only, please.