R/medianimp.R

medianimp <-
function(mat)
{
m<-ncol(mat)
for (i in 1:m)
{
median<-quantile(mat[which(is.na(mat[,i])==FALSE),i], prob=0.5, type=1)[[1]]
mat[which(is.na(mat)[,i]),i]<-median
}
mat
}

Try the ForImp package in your browser

Any scripts or data that you put into this service are public.

ForImp documentation built on May 2, 2019, 8:17 a.m.