title: Find nearest smaller number
body: <p>I have a vector of numbers</p>
  <pre><code>f &lt;- c(1, 3, 5, 8, 10, 12, 19, 27)
  </code></pre>
  <p>I want to compare the values in the vector to another number, and find the closest <em>smaller</em> value.</p>
  <p>For example, if the input number is 18, then the closest, smaller value in the vector is 12 (position 6 in the vector).
  If the input is 19, then the result should be the value 19, i.e. the index 7.</p>