Pages

Tuesday, September 16, 2014

How to replace the missing values with median

f=function(x){
   x<- span="">as.numeric(as.character(x)) #first convert each column into numeric if it is from factor
   x[is.na(x)] =median(x, na.rm=TRUE) #convert the item with NA to median value from the column
   x #display the column
}
ss=data.frame(apply(df,2,f))

1 comment:

  1. Casino of the Orient | Mapyro
    Casino of the Orient. Casinos. 15 Highway 14. Stateline, 상주 출장샵 Nevada 89449. 군산 출장마사지 Directions 공주 출장마사지 · (702) 770-8263. Call Now 오산 출장마사지 · More Info. Hours, 광주 출장안마 Accepts Credit Cards, Wi-Fi. Rating: 4.1 · ‎10 votes

    ReplyDelete