R/na.mean.R

Defines functions na.mean

Documented in na.mean

na.mean=function(x){
  ### replace missing entries with mean for that column.
  namean=function(x){
    nas=is.na(x)
    if(any(nas))  x[nas]=mean(x,na.rm=TRUE)
    x
  }
  apply(x,2,namean)
}

Try the glmnet package in your browser

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

glmnet documentation built on Aug. 22, 2023, 9:12 a.m.