search for: pairdist

Displaying 3 results from an estimated 3 matches for "pairdist".

2005 Jan 28
3
avoiding loops
Hi again, thanks a lot for the quick answer. I just forgot the comma, always these stupid mistakes... Anyways, as I said before, I have two data.frames containing about 1000 rows and I would like to avoid looping through all of them... In each data.frame are coordinates (x,y,z), so every row is giving the information on one single point. I would like to calculate the distance from each point
2009 Jan 28
1
Neighborhood distance calculator
...d y on the first two columns. Could have more than two columns, or exactly two columns, it doesn't matter. #produces a "list" object with a vector of the neighbors for each location #distance defines the range within which we define neighbors nd=length(data[,1]) nbmat=list(array) dist=pairdist(data[,1:2]) for(i in 1:nd){ nbmat[[i]]=0 for(j in 1:nd) if((dist[i,j]<distance)&(i!=j)) nbmat[[i]]=c(nbmat[[i]],j) nbmat[[i]]=nbmat[[i]][nbmat[[i]]!=0]} return(nbmat) } -----------------------------------------------------------------------------------------------------------------...
2009 Jan 28
2
t.test in a loop
Hi All, I've been having a little trouble with creating a loop that will run a a series of t.tests for inspection, Below is the code i've tried, and some checks i've looked at. I've used the get(paste()) idea as i was told previously that the use of the eval should try and be avoided. I've run a single syntax to check that my systax is correct and works without any problems