Replace (i.e. mask) NA values with other symbol

na.replace(obj, replacement = " ")

Arguments

obj

an objecta, that may have NA values

replacement

a replacement for NA values. default is spece (" ").

Value

the same object with NA values replaced.

Examples


library(pander)
library(magrittr)

summary(CO2[,3:4])  %>% pander()
#> 
#> ------------------------------
#>    Treatment         conc     
#> --------------- --------------
#>  nonchilled:42    Min.  : 95  
#> 
#>   chilled :42    1st Qu.: 175 
#> 
#>       NA         Median : 350 
#> 
#>       NA          Mean : 435  
#> 
#>       NA         3rd Qu.: 675 
#> 
#>       NA         Max.  :1000  
#> ------------------------------
#> 
summary(CO2[,3:4])  %>% na.replace() %>% pander()
#> 
#> ------------------------------
#>    Treatment         conc     
#> --------------- --------------
#>  nonchilled:42    Min.  : 95  
#> 
#>   chilled :42    1st Qu.: 175 
#> 
#>                  Median : 350 
#> 
#>                   Mean : 435  
#> 
#>                  3rd Qu.: 675 
#> 
#>                  Max.  :1000  
#> ------------------------------
#>