[Rd] cor() fails with big dataframe

From: Mayeul KAUFFMANN <mayeul.kauffmann_at_tiscali.fr>
Date: Thu 16 Sep 2004 - 09:23:09 EST


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



R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu Sep 16 09:28:35 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 09:00:18 EST