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

From: Ken Spriggs <ksspriggs_at_gmail.com>
Date: Thu, 28 Feb 2008 07:14:47 -0800 (PST)

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
>
> stats::cor(x1,x2)
>
> ?
>
>
>
> Ken Spriggs wrote:

>> 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 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 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) = is.numeric(x2) = TRUE
>>>> 4.  which(is.na(x1))  = which(is.na(x2)) = integer(0)   {the same goes
>>>> for
>>>> is.nan()}
>>>> 5.  I also try cor(x1,x2, use = "all.obs") and get the same error.
>>>>
>>>> What can be going wrong?
>>>>
>>>>
>>> ______________________________________________
>>> R-help_at_r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>>
>>

>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
-- 
View this message in context: http://www.nabble.com/Error-in-cor.default%28x1%2C-x2%29-%3A-missing-observations-in-cov-cor-tp15723848p15738590.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 28 Feb 2008 - 15:27:17 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 28 Feb 2008 - 15:30:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive