Re: [R] Error in cor.default(x1, x2) : missing observations in cov/cor

2008-02-28 Thread Erik Iverson
So you did have NAs in your data? what do > any(is.na(x1)) and > any(is.na(x2)) give? Ken Spriggs wrote: > Thanks. Your suggestion works. > > > Daniel Malter wrote: >> Does the code below solve your problem? If you have NAs in the same rows, >> you have to use "c" or "p" as use= param

Re: [R] Error in cor.default(x1, x2) : missing observations in cov/cor

2008-02-28 Thread Ken Spriggs
Here's what happened... > stats::cor(x1,x2) Error in stats::cor(x1, x2) : missing observations in cov/cor Erik Iverson wrote: > > OK, that is not the definition of cor in the stats package. Some add-on > package you are loading might be overwriting it. > > What happens if you do > > stat

Re: [R] Error in cor.default(x1, x2) : missing observations in cov/cor

2008-02-28 Thread Ken Spriggs
Thanks. Your suggestion works. Daniel Malter wrote: > > Does the code below solve your problem? If you have NAs in the same rows, > you have to use "c" or "p" as use= parameters. Otherwise you get the error > you described. > > a=c(1,2,3,4,NA,6) > b=c(2,4,3,5,NA,7) > > which(is.na(a))==

Re: [R] Error in cor.default(x1, x2) : missing observations in cov/cor

2008-02-28 Thread Ken Spriggs
Thanks. > find("cor") [1] "package:fUtilities" "package:stats" Rolf Turner-3 wrote: > > > On 28/02/2008, at 11:11 AM, Ken Spriggs wrote: > >> >> I get the following >> >>> class(x1) >> [1] "numeric" >>> class(x2) >> [1] "numeric" >> >> and: >> >>> cor(x1,x2) >> Error in cor.default(x1, x

Re: [R] Error in cor.default(x1, x2) : missing observations in cov/cor

2008-02-27 Thread Daniel Malter
Sorry, I overlooked the = integer(0) result to which(is.na(x1))==which(is.na(x2)). So that's not it. Cheers. - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: Daniel Malter [mailto:[EMAIL PROTECTED] Gesendet: Wednesday, Feb

Re: [R] Error in cor.default(x1, x2) : missing observations in cov/cor

2008-02-27 Thread Daniel Malter
Does the code below solve your problem? If you have NAs in the same rows, you have to use "c" or "p" as use= parameters. Otherwise you get the error you described. a=c(1,2,3,4,NA,6) b=c(2,4,3,5,NA,7) which(is.na(a))==which(is.na(b)) cor(a,b) Error cor(a,b,use="all.obs") Error c

Re: [R] Error in cor.default(x1, x2) : missing observations in cov/cor

2008-02-27 Thread Rolf Turner
On 28/02/2008, at 11:11 AM, Ken Spriggs wrote: > > I get the following > >> class(x1) > [1] "numeric" >> class(x2) > [1] "numeric" > > and: > >> cor(x1,x2) > Error in cor.default(x1, x2) : missing observations in cov/cor >> traceback() > 2: cor.default(x1, x2) > 1: cor(x1, x2) ``Clearly'' you mu

Re: [R] Error in cor.default(x1, x2) : missing observations in cov/cor

2008-02-27 Thread Erik Iverson
OK, that is not the definition of cor in the stats package. Some add-on package you are loading might be overwriting it. What happens if you do stats::cor(x1,x2) ? Ken Spriggs wrote: > I get the following: > >> cor > function (x, y = NULL, use = "all.obs", method = c("pearson", > "ken

Re: [R] Error in cor.default(x1, x2) : missing observations in cov/cor

2008-02-27 Thread Ken Spriggs
I get the following: > cor function (x, y = NULL, use = "all.obs", method = c("pearson", "kendall", "spearman")) { UseMethod("cor") } Erik Iverson wrote: > > What happens when you type "cor" at the R prompt? Perhaps your calling > of the cor function is not calling the cor functi

Re: [R] Error in cor.default(x1, x2) : missing observations in cov/cor

2008-02-27 Thread Ken Spriggs
I get the following > class(x1) [1] "numeric" > class(x2) [1] "numeric" and: > cor(x1,x2) Error in cor.default(x1, x2) : missing observations in cov/cor > traceback() 2: cor.default(x1, x2) 1: cor(x1, x2) Peter Dalgaard wrote: > > Ken Spriggs wrote: >> Hello, >> >> I'm trying to do cor(x1,

Re: [R] Error in cor.default(x1, x2) : missing observations in cov/cor

2008-02-27 Thread Erik Iverson
What happens when you type "cor" at the R prompt? Perhaps your calling of the cor function is not calling the cor function in the stats package? Ken Spriggs wrote: > Hello, > > I'm trying to do cor(x1,x2) and I get the following error: > Error in cor.default(x1, x2) : missing observations in

Re: [R] Error in cor.default(x1, x2) : missing observations in cov/cor

2008-02-27 Thread Peter Dalgaard
Ken Spriggs wrote: > Hello, > > I'm trying to do cor(x1,x2) and I get the following error: > Error in cor.default(x1, x2) : missing observations in cov/cor > > A few things: > 1. I've used cor() many times and have never encountered this error. > 2. length(x1) = length(x2) > 3. is.numeric(x1) =