search for: specdist

Displaying 1 result from an estimated 1 matches for "specdist".

Did you mean: seadist
2008 Jul 30
1
problem with nested loops
...p: 20 rows and 14 columns I want to: calculate a distance value with the first 40 rows of pnr but 20times with the 1st row of mvp then the next 40 rows of pnr and 20times with the second row of mvp and so on. in total 20 times. i tried with: > dim(p) [1] 800 14 > dim(mvp) [1] 20 14 specdist <-matrix(NA,nrow=40,ncol=20) for (j in 1:40){ for(i in 1:20){ specdist[j,i]<-sqrt((pnr[i,1]-mvp[i,1])^2+(pnr[i,2]-mvp[i,2])^2)+....+(pnr[i,14]-mvp[i,14])^2)) } } but it only repeats from 1:40 and does not step from 41 to 80; from 81 to 40 etc. certainly there is a "if" "e...