[R] nearest neighbours and their ID
Rolf Turner
rolf.turner at xtra.co.nz
Thu Jun 21 03:21:59 CEST 2012
?nnwhich
cheers,
Rolf Turner
On 21/06/12 04:06, Lucie V wrote:
>
>
>
>
>
> Dear R users,
>
> I used nndist() to gain the distance of 2 nearest
> neighbours of the points in my dataset. Is there a way of getting the ID numbers
> of these nearest neighbours (along with their distances).
>
> The command I used: nn2<- nndist(X2, k=1:2). This is the output of the nearest neighbour distances I got (the IDs of the given points are there but their IDs aren't). Any help or suggestionsare very much appreciated.> d1to2 [,1] [,2]
>
> [1,] 1.9721585 2.979509
>
> [2,] 1.9342647 1.972158
>
> [3,] 0.2402082 1.934265
>
> [4,] 0.2402082 2.074910 etc...
>
>
>
>
>
> Thank you
>
> Luc
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>
More information about the R-help
mailing list