On Tue, Jul 24, 2012 at 09:26:49AM -0700, olemissrebs1123 wrote: > I was wondering if there is a way in R to find k nearest neighbors of various > orders, say order 2, 3, or 4. In otherwords neighbors of neighbors of > neighbors. You get the idea. I know that I can use knearneigh(matrix.data, > k) but this only gives me the k nearest neighbors and not of a particular > order.
Hi. If i understand correctly, then this may be achieved by several iterations. In the first iteration, the nearest neighbours are found. The next iteration starts from them a finds their nearest neighbours. These are neighbours of order 2. A general iteration finds neighbours of order n by looking for neighbours of the points found in the previous step, which are the neighours of order n-1. Hope this helps. Petr Savicky. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.