title: Removing empty cells when using as.character in R
body: <p>I have a table that look like this</p>
  
  <pre><code>A   B   C
  AB ABC  CBS
  AB      ABC
     ADS  
          BBB
  </code></pre>
  
  <p>A want to use the columns as a character so is used this</p>
  
  <pre><code> A= as.character(table$A) 
  </code></pre>
  
  <p>this results in <code>c(“AB”, “AB”, “”)</code> my goal was <code>c(“AB”, “AB”)</code>, so without the empty cell <code>""</code>.   To get wit of the empty cell I used this   <code>A=A[!A==""]</code> which gives the results I want, but there must be a more elegant way of accomplishing the same goal.</p>
  
  <p>May questions are 1) is there a better way of removing empty characters/cells.
  Or more general 2) is there a way to transform the 3 columns (A,B,C) into characters A, B, C without the empty cells.</p>
  
  <p>Thanks</p>
  
  <pre><code> 'data.frame':  3 obs. of  3 variables:
           $ A: Factor w/ 2 levels "","AB": 2 2 1
           $ B: Factor w/ 3 levels "","ABC","ADS": 2 1 3
           $ C: Factor w/ 3 levels "ABC","BBB","CBS": 3 1 2
  </code></pre>