title: Error in if/while (condition) { : argument is of length zero
body: <p>I received the error </p>
  
  <pre><code>Error in if (condition) { : argument is of length zero
  </code></pre>
  
  <p>or</p>
  
  <pre><code>Error in while (condition) { : argument is of length zero
  </code></pre>
  
  <p><strong>What causes this error message, and what does it mean?</strong></p>
  
  <p>On further inspection it seems that the value is <code>NULL</code>.</p>
  
  <pre><code>condition
  ## NULL
  </code></pre>
  
  <p><strong>In order to deal with this error, how do I test for NULL values?</strong></p>
  
  <p>I expected that this would return <code>TRUE</code>, but I got an empty logical value:</p>
  
  <pre><code>condition == NULL
  ## logical(0)
  </code></pre>