search for: eucdist

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

2011 Nov 18
1
Delete Rows Dynamically Within a Loop
...discbuff$bdry[[1]]$x, y = discbuff$bdry[[1]]$y) out = pnt.in.poly(pnts,polypnts) out$ID <- df$ID[-i] if (any(out$pip == 1)) { pnt.inBuffID <- out$ID[which(out$pip == 1)] cond <- df$Sex[i] != df$Sex[pnt.inBuffID] if (any(cond)){ eucdist <- sqrt((df$X[i] - df$X[pnt.inBuffID][cond])^2 + (df$Y[i] - df$Y[pnt.inBuffID][cond])^2) IDvect <- pnt.inBuffID[cond] new_colonies_temp <- data.frame(ID1=df$ID[i], ID2=IDvect[which(eucdist==min(eucdist))], X=(df$X[i] + df$X[pnt.inBuffID][cond][which(eucdi...