Skip to content
Prev 31117 / 398506 Next

Missing Value And cor() function

replace.na.m <- function (x){
    X<-mean(x,na.rm=TRUE)
    ifelse ( is.na(x)=="TRUE",X,x)
}

apply(data.frame,2,replace.na.m)

another way is using cor() and the option
 use: an optional character string giving a method for computing
          covariances in the presence of missing values.  This must be
          (an abbreviation of) one of the strings `"all.obs"',
          `"complete.obs"' or `"pairwise.complete.obs"'.

perhaps this helps you,
regards,christian


----- Original Message -----
From: <vincent.stoliaroff at socgen.com>
To: <r-help at stat.math.ethz.ch>
Sent: Thursday, April 24, 2003 12:27 PM
Subject: [R] Missing Value And cor() function
values
or by any other relevant figures ?
any idea if it exists and have some trouble to figure out how it could)
{{dropped}}