Suppose we have vectors x and y of same size. Then we plotted x vs. y using plot(x,y) in R. How to find the least dense part of this curve?

k<-length(x)

a<-c()

for(i in c(1:k-1)) {

t<-sqrt((x[i+1]-x[i])^2+(y[i+1]-y[i])^2)

a<-c(a, t)

}

a<-c(a, t)

plot(x,a)

## No comments:

Post a Comment