Displaying 1 result from an estimated 1 matches for "trn1".
Did you mean:
rn1
2005 Sep 27
1
missing handling
Hi,
I have the following codes to replace missing using median, assuming missing
only occurs on continuous variables:
trn1<-read.table('trn1.fv', header=F, na.string='.', sep='|')
# median
m.trn1<-sapply(1:ncol(trn1), function(i) median(trn1[,i], na.rm=T))
#replace
trn2<-trn1
for (each in 1:nrow(trn1)){
index.missing=which(is.na(trn1[each,]))
trn2[each,]<-replace(trn1[each,], index...