title: Replace blank cell with "no" in R
body: <p>I like to replace blank cells (" ") in a column with "no". The missing entries do have a meaning for me (no score determined yet) and I like to use the factor variable in a regression tree later. </p>
  
  <p>I found a similar question here (<a href="https://stackoverflow.com/questions/21243588/replace-blank-cells-with-character">Replace blank cells with character</a>) and tried the following, but then the blank cells are converted to NA and not as text:</p>
  
  <pre><code>&gt; Test$SCORE[Test$SCORE==" "]&lt;- "no"
  
  Warning message:
  In `[&lt;-.factor`(`*tmp*`, Test$SCORE == " ", value = c(NA, NA, 8L,  :
    invalid factor level, NA generated
  </code></pre>
  
  <p>Is there a way to avoid NA and use my own text? </p>
  
  <p>Please see example data "Test": </p>
  
  <pre><code>ID  Score  
   1. A
   2. " "
   3. B
   4. " "
   5. C
  </code></pre>
  
  <p>Is there a way to avoid NA and use my own text? 
  This is the result I like to achieve:  </p>
  
  <pre><code>ID  Score
  1   A
  2   "no"
  3   B 
  4   "no"
  5   C
  </code></pre>
  
  <p>The dataset is very large therefore a manual solution via indexing specific rows is quite time consuming.
  I appreciate your help because R is quite new for me. </p>
  
  <p>Thank you very much in advance.</p>
  
  <p>Additional info: </p>
  
  <blockquote>
    <p>str(Test$SCORE)
     Factor w/ 13 levels " ","A","B","C",..</p>
  </blockquote>
  
  <p>Please excuse the format of the example table, but this is my first question.</p>