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
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
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))==
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
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
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
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
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
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
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,
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
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) =
12 matches
Mail list logo