[Rd] cor() fails with big dataframe
Mayeul KAUFFMANN
mayeul.kauffmann at tiscali.fr
Thu Sep 16 01:23:09 CEST 2004
Hello,
I have a big dataframe with *NO* na's (9 columns, 293380 rows).
# doing
memory.limit(size = 1000000000)
cor(x)
#gives
Error in cor(x) : missing observations in cov/cor
In addition: Warning message:
NAs introduced by coercion
#I found the obvious workaround:
COR <- matrix(rep(0, 81),9,9)
for (i in 1:9) for (j in 1:9) {if (i>j) COR[i,j] <- cor (x[,i],x[,j])}
#which works fine, with no warning
#looks like a "cor()" bug.
#I checked absence of NA's by
x <- x[complete.cases(x),]
summary(x)
apply(x,2, function (x) (sum(is.na(x))))
#I use R 1.9.1
Cheers,
Mayeul KAUFFMANN
Université Pierre Mendès France
Grenoble - France
More information about the R-devel
mailing list