title: Find index of value in a sorted vector in R
body: <p>I have an ordered vector of unique integers in R and I want to find the index of the element closest to but less than or equal to some value. For example, for the vector <code>4 8 15 16 23 42</code> and the search value <code>17</code>, I would like the function to return <code>4</code>, the index of <code>16</code>. In Python, I would use
  <a href="https://docs.python.org/2/library/bisect.html" rel="nofollow">bisect</a> module. Is there anything similar in R?</p>