title: R -- how to ignore "Undefined" Columns in a dataset
body: <h1>Data Set:</h1>
  <pre><code>    V1          V2
  1   Undefined   E1
  2   Undefined   E2
  3   Undefined   E3
  4   Undefined   E4
  5   Undefined   E5
  6   Undefined   E6
  7   Undefined   E7
  8   Undefined   E8
  </code></pre>
  <h1>Question:</h1>
  <p>Above is a data set I'm trying to plot in R as a bar plot with another 4 datasets. The other 4 have actual data in V1, but this is dataset shows an undefined column. Can anyone help me write something that will allow R to ignore this dataset? For instance, if I had 4 datasets and 2 of them had an &quot;Undefined&quot; in them, R would ignore them and only plot 2 bins? Right now, R is plotting each Undefined as a bin with height of 1. If someone could help just get rid of this bin altogether, that'd be great.</p>
  <h1>Here is a picture of my problem:</h1>
  <p><a href="http://oi40.tinypic.com/27zx7oo.jpg" rel="nofollow noreferrer">http://oi40.tinypic.com/27zx7oo.jpg</a></p>
  <p>I would like to get rid of that 4th bar in each set altogether. Note that I can't set it to 0, as that is inaccurate. I would like to just avoid it altogether.</p>
  <h1>Below is my code:</h1>
  <pre><code>k_o_asdf &lt;- read.delim(&quot;/Users/asdfman/Combinations/k_open/asdf.state&quot;, header=F)
  m_o_asdf &lt;- read.delim(&quot;/Users/asdfman/Combinations/m_open/asdf.state&quot;, header=F)
  k_c_asdf &lt;- read.delim(&quot;/Users/asdfman/Combinations/k_closed/asdf.state&quot;, header=F)
  m_c_asdf &lt;- read.delim(&quot;/Users/asdfman/Combinations/m_closed/asdf.state&quot;, header=F)
  
  d &lt;- data.frame(row.names=c(&quot;E1&quot;, &quot;E2&quot;, &quot;E3&quot;, &quot;E4&quot;, &quot;E5&quot;, &quot;E6&quot;, &quot;E7&quot;, &quot;E8&quot;), K.Open = c(k_o_asdf$V1), M.Open = c(m_o_asdf$V1), K.Closed = c(k_c_asdfV1), M.Closed = c(m_c_asdf$V1))
  
  d &lt;- do.call(rbind, d)
  barplot(d, beside = TRUE,ylim=c(0,2), legend.text = rownames(d), 
      args.legend = list(x = &quot;topleft&quot;, bty=&quot;n&quot;))
  </code></pre>
  <p>Thanks very much for the help! If anything's unclear, let me know!</p>