Make a data frame of two columns based on values less than a threshold value in column 2 in r : <p>I want to make a data frame that only has entries below a certain defined threshold that is compared with column b, such that entry "OP2775iib SAV OP2958i_b POR" is excluded.</p>

<p>I tried this code:</p>

<pre><code>less_than_threshold &lt;- data.frame(which(data[data$b &lt; threshold]))
</code></pre>

<p>but it returns and error that I cant quite grasp:</p>

<p>Error in <code>[.data.frame</code>(pairwise_ind_Mdists, pairwise_ind_Mdists$Mdist &lt;  : 
  undefined columns selected</p>

<p>This is a sample of the data I'm working with:</p>

<pre><code>data &lt;- data.frame(a = c("OP2775iia MOU OP2775iib SAV","OP2775iia MOU OP2958i_a COM","OP2775iib SAV OP2958i_a COM","OP2775iia MOU OP2958i_b POR","OP2775iib SAV OP2958i_b POR"),
                           b = c(4.9022276,3.8867063,3.0126033,5.0261763,6.3745697))

threshold &lt;- 6.3745697
</code></pre>

<p>I want a data frame that has all the entries from the original dataset except for the last entry "OP2775iib SAV OP2958i_b POR"</p>
