title: Selecting unique value from unequal character strings in R
body: <p>I am writing a code to pull data from a database which removes item columns that contain all NAs.  I want R to tell give me the column name of the removed column.  I have newdat and newdat1, which is the data before and after removal of the columns that contain NA.  Thus, so far I have:</p>
  
  <pre><code>&gt; name&lt;-colnames(newdat)
  &gt; name
  [1] "i5" "i4" "i2" "i3" "i1" "b4" "b3" "b2" "b1"
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&gt; name1&lt;-colnames(newdat1)
  &gt; name1
  [1] "b3" "i5" "i4" "i2" "b2" "b1" "i3" "i1"
  </code></pre>
  
  <p>Thus, I have two character strings of unequal length with 8 values that are the same and 1 that is unique to newdat1.  How can I extract this value?  I have tried variations of <code>unique</code> and <code>which</code> functions such as:</p>
  
  <pre><code>xnames&lt;-name1[-which(name1==name)]
  </code></pre>
  
  <p>But I get an error because they are unequal lengths.  Please help!  Thank you.</p>