R - check if a variable exists
<p>I thought I had figured this one out. I have a variable called:</p>

<pre><code>count_1
</code></pre>

<p>It's just a vector with one element. As I go through my loops, sometimes it has a value, and at other times it doesn't. All I want to do is ask if it contains anything, and if not, merely loop back around. Right now my script fails because when count_1 is empty, I get this:</p>

<blockquote>
  <p>missing value where TRUE/FALSE needed
  Execution halted</p>
</blockquote>

<p>Here is my attempt so far:</p>

<pre><code>if (exists("count_1"))
  { 
    #code#
  }
</code></pre>