R column of ints find nearest value
<p>I have a frame</p>

<pre><code>J = data.frame(Entry = c(100, 5, 10, 20, 35))
</code></pre>

<p>For each record I want to find the nearest value and end up with</p>

<pre><code>Entry | nearest
 100  |  35
 5    |  10
 20   |  10
 35   |  20
</code></pre>

<p>I looked at the data table code <a href="https://stackoverflow.com/questions/20133344/find-closest-value-in-a-vector-with-binary-search">Find closest value in a vector with binary search</a></p>

<p>but because for <code>Entry</code> I am trying to find the closest value it just returns the vector that I enter. How can I do this? </p>