Hello,

Suppose I have two vectors in R->

x<- c(12,34,26,87)

and another vector

y<- c(2,45,43,21,12)

and I want a vector of dim(y) to be returned which would tell how many of the values in vector x are greater than/less than/equal to the individual values in y. How can I do this in R?

In other words, How can I perform this task without for loop->

z<-rep(0,length(y))

for(i in 1:length(y))

{

for(j in 1:length(x))

{

if(x[j]>y[i])

z[i]=z[i]+1

}

}

z

[1] 4 1 1 3 3

Thanks.