One of my variable is about the type of Garbage Disposal.Heres what the summary of the field in R.
  summary(train$GarageType)
 2Types  Attchd Basment BuiltIn CarPort  Detchd    NA's 
      6     870      19      88       9     387      81
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 '' .
How to give train$GarageType <- 'null' when train$garbage = NA >
Expected OutPut will be like
      summary(train$GarageType)
     2Types  Attchd Basment BuiltIn CarPort  Detchd    NULL
          6     870      19      88       9     387      81
Such that Null is a valid kind.
Closest solution I got is
> x<-train
> x$GarageType <- factor(ifelse( is.na(x$GarageType), "NULL", x$GarageType))
> summary(x$GarageType)
   1    2    3    4    5    6 **NULL** 
   6  870   19   88    9  387   81 
> summary(train$GarageType)
 2Types  Attchd Basment BuiltIn CarPort  Detchd    **NA's** 
      6     870      19      88       9     387      81 
Now, I could rename NA with NULL but others like 2Types , Attchd etc became 1,2 etc.
 
     
     
    
summary(x$GarageType)
1 2 3 4 5 6 NILL
6 870 19 88 9 387 81
What I need is
2Types Attchd Basment BuiltIn CarPort Detchd NILL
6 870 19 88 9 387 81
As I give Summary, I need NA to be replaced by Null or Nill or some custome value. – user2458922 Nov 06 '17 at 15:41