Re: [R] nearest neighbour

2014-04-15 Thread Rolf Turner
Sorry, your communication *was* on-list. I guess my eyes are going! Please ignore the first sentence of my previous post. cheers, Rolf __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guid

Re: [R] nearest neighbour

2014-04-15 Thread Rolf Turner
Please keep communications on-list unless there is a genuine reason not to. To answer your question: Yes, you need to convert to ppp format; the nnwhich() function requires its first argument to be of class "ppp". My example showed you how to construct or "estimate" a window if you don't have

Re: [R] nearest neighbour

2014-04-15 Thread Monaly Mistry
Hi Rolf, Thank you very much, I just have one other question, do I need to change the data frame into ppp format? I've tried using as.ppp but get the following error message: Error: x,y coords given but no window specified Best, Monaly. On Thu, Apr 3, 2014 at 9:23 PM, Rolf Turner wrote: >

Re: [R] nearest neighbour

2014-04-03 Thread Rolf Turner
On 04/04/14 01:16, Monaly Mistry wrote: Hi, If I have a data frame of the location of individuals (x and y coordinate), how do I find the 5 nearest neighbours for each individual. The nnwhich() function from the spatstat package will do this for you. E.g.: require(spatstat) # You need to hav

[R] nearest neighbour

2014-04-03 Thread Monaly Mistry
Hi, If I have a data frame of the location of individuals (x and y coordinate), how do I find the 5 nearest neighbours for each individual. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/l

Re: [R] Nearest neighbour in a matrix

2011-10-01 Thread Spartina
Hi, sorry for the late reply. I just wanted to thank both of you for your answers. They were helpful and also thank you for mentioning the website that has the tutorials which is a most helpful resource. Cheers, Léa -- View this message in context: http://r.789695.n4.nabble.com/Nearest-neighbou

Re: [R] Nearest neighbour in a matrix

2011-09-26 Thread David Winsemius
On Sep 26, 2011, at 7:56 PM, Spartina wrote: Hello all, I am brand new to R and doing an exercise for a class. I need to find the nearest neighbour for points in the following matrix: DistanceMatrix x1 x2 x3 x4 x5 [1,] 0.00 2.828427 1.581139 2.236068

Re: [R] Nearest neighbour in a matrix

2011-09-26 Thread R. Michael Weylandt
There's a general no homework policy on this list, but if you use apropos() with some fairly intuitive search terms the problem won't be hard at all once you hit the 'magic' function. You also might want to look at "?apply". After that, ask your TA... Sorry we couldn't be more help, Michael

[R] Nearest neighbour in a matrix

2011-09-26 Thread Spartina
Hello all, I am brand new to R and doing an exercise for a class. I need to find the nearest neighbour for points in the following matrix: > DistanceMatrix x1 x2 x3 x4 x5 [1,] 0.00 2.828427 1.581139 2.236068 2.00 [2,] 2.828427 0.00 1.581139 4.123106