title: How to find element index when element is determined from quantile function?
body: <p>How can I find the index of an element, when the element is determined using <code>quantile()</code>?
  The <code>match()</code> and <code>which()</code> solutions from this <a href="https://stackoverflow.com/questions/5577727/is-there-an-r-function-for-finding-the-index-of-an-element-in-a-vector">similar question</a> do not work (they return NA), and I think they don't work because of rounding issues.</p>
  <p>In the case that the quantile result is averaged/interpolated across two indices, can I specify if it takes the lower/higher index? My data <code>x</code> will always be sorted.</p>
  <p>Example Dataset (Obviously the 0 and 1 quantiles here are just the min and max, they are just shown for a sanity check)</p>
  <pre><code>x &lt;- c(0.000000e+00,9.771228e-09,5.864592e-06,3.474925e-04,9.083242e-04,2.458036e-02)
  quantile(x, probs = c(0, 0.5, 1))
            0%          50%         100% 
  0.0000000000 0.0001766785 0.0245803600 
  </code></pre>
  <p>How do I find the indices for these quantiles? Here, the indices are <code>1,??,6</code>.
  And I guess the median is the average of two indices, so can I specific that it returns the first or second index?</p>