How to subset data in R without losing NA rows?
<p>I have some data that I am looking at in R. One particular column, titled "Height", contains a few rows of NA. </p>

<p>I am looking to subset my data-frame so that all Heights above a certain value are excluded from my analysis. </p>

<pre><code>df2 &lt;- subset ( df1 , Height &lt; 40 )
</code></pre>

<p>However whenever I do this, R automatically removes all rows that contain NA values for Height. I do not want this. I have tried including arguments for na.rm</p>

<pre><code>f1 &lt;- function ( x , na.rm = FALSE ) {
df2 &lt;- subset ( x , Height &lt; 40 )
}
f1 ( df1 , na.rm = FALSE )
</code></pre>

<p>but this does not seem to do anything; the rows with NA still end up disappearing from my data-frame. Is there a way of subsetting my data as such, without losing the NA rows? </p>