title: Replace NA with a Default value
body: <p>One of my variable is about the type of Garbage Disposal.Heres what the summary of the field in R.</p>
  
  <pre><code>  summary(train$GarageType)
  
   2Types  Attchd Basment BuiltIn CarPort  Detchd    NA's 
        6     870      19      88       9     387      81
  </code></pre>
  
  <p>Now, I know that where ever NA is, there is No Garbage Disposal in place. Hence I need to put a value like 'null' of ''  .</p>
  
  <p>How to give train$GarageType &lt;- 'null' when train$garbage = NA > </p>
  
  <pre><code>Expected OutPut will be like
        summary(train$GarageType)
  
       2Types  Attchd Basment BuiltIn CarPort  Detchd    NULL
            6     870      19      88       9     387      81
  </code></pre>
  
  <p>Such that Null is a valid kind.</p>
  
  <p>Closest solution I got is</p>
  
  <pre><code>&gt; x&lt;-train
  &gt; x$GarageType &lt;- factor(ifelse( is.na(x$GarageType), "NULL", x$GarageType))
  &gt; summary(x$GarageType)
     1    2    3    4    5    6 **NULL** 
     6  870   19   88    9  387   81 
  &gt; summary(train$GarageType)
   2Types  Attchd Basment BuiltIn CarPort  Detchd    **NA's** 
        6     870      19      88       9     387      81 
  </code></pre>
  
  <p>Now, I could rename NA with NULL but others like 2Types , Attchd etc  became 1,2 etc.</p>