R/near.bound.r

Defines functions near.bound

Documented in near.bound

near.bound<-function(X,Y,bX,bY){
  euc<-function(x1,x2,y1,y2)sqrt((x1-x2)^2+(y1-y2)^2)##euclidean distance
n<-length(X)
nb<-length(bX)
e<-matrix(ncol=n,nrow=nb)
  for(i in 1:n){
  e[,i]<-euc(X[i],bX,bY,Y[i])
  }
mn<-apply(e,2,function(x){which(x==min(x))})
xy.bound<-data.frame(near.X.coord=bX[mn],near.Y.coord=bY[mn])
xy.bound
}

Try the asbio package in your browser

Any scripts or data that you put into this service are public.

asbio documentation built on Aug. 20, 2023, 9:07 a.m.