0

Suppose we have a data frame of two columns

 X    Y 
 9   11
 10  14   
 13  17  
 17  20   
 21  23

For the first element of Y, that is 11, the closest but "less than or equal to" in X is 10 (which is 2nd element of X). Similarly, For next element of Y, that is 14, the closest but "less than or equal to" is 13 that is 3rd element of X

So, the output should be

2
3
4
4
5

As my data is large, Can you suggest me the right way to do it ? (Note: Max of "less than or equal to " is same as "the closest but less than or equal to")

Navin Manaswi
  • 964
  • 7
  • 19

0 Answers0