why nrow(dataframe) and length(dataframe) in r give different results?
<p>I have a ordered data frame and want to know the number of the last row.</p>

<pre><code>data_ranking &lt;- reduced_data[order(reduced_data$outcome,reduced_data$hospital,na.last=NA),]
nobs &lt;- nrow(data_ranking)
</code></pre>

<p>gives me different results of</p>

<pre><code>data_ranking &lt;- reduced_data[order(reduced_data$outcome,reduced_data$hospital,na.last=NA),]
nobs &lt;- length(data_ranking)
</code></pre>

<p>I would like to understand why is that. It seems that <code>nrow</code>gives me the answer I'm looking for, but I don't understand why.</p>