title: Fastest way to check if dataframe is empty
body: <p>What is the fastest (every microsecond counts) way to check if a <code>data.frame</code> is empty? I need it in the following context: </p>
  
  <pre><code>if (&lt;df is not empty&gt;) { do something here }
  </code></pre>
  
  <p>Possible solutions:</p>
  
  <p>1) <code>if(is.empty(df$V1) == FALSE</code> from `spatstat' package</p>
  
  <p>2) if(nrow(df) != 0) </p>
  
  <p>3) Your solution</p>
  
  <p>I could do:</p>
  
  <pre><code>library(microbenchmark)
  microbenchmark(is.empty(df),times=100)
  Unit: microseconds
           expr min  lq mean median  uq max neval
   is.empty(df) 5.8 5.8  6.9      6 6.2  66   100 
  </code></pre>
  
  <p>but not sure how to time 2). And what is your solution to empty df? </p>
  
  <p>Thanks!  </p>