Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR R

imputation in r

library(Hmisc)
impute(BostonHousing$ptratio, mean)  # replace with mean
impute(BostonHousing$ptratio, median)  # median
impute(BostonHousing$ptratio, 20)  # replace specific number
# or if you want to impute manually
BostonHousing$ptratio[is.na(BostonHousing$ptratio)] <- mean(BostonHousing$ptratio, na.rm = T)  # not run
Source by r-statistics.co #
 
PREVIOUS NEXT
Tagged: #imputation
ADD COMMENT
Topic
Name
9+3 =