Re: [R] making spearman correlation cor() call fail with log(0) as input

2008-09-14 Thread Timur Shtatland
Hi Martin, I got my initial question fully answered. I do not have enough experience to to judge whether the behavior of R with regard to Inf is excellent or better than Perl. In my opinion, both Perl and R are great languages, designed for very different applications. So instead of me trying to

Re: [R] making spearman correlation cor() call fail with log(0) as input

2008-09-13 Thread Martin Maechler
TS == Timur Shtatland [EMAIL PROTECTED] on Fri, 12 Sep 2008 11:52:25 -0400 writes: TS I am more used to getting an error if you try to take TS the log of 0, like this (in Perl): TS perl -le 'for my $num (1, 0, -1, -2) { print log $num; TS }' 0 Can't take log of 0 at -e line

Re: [R] making spearman correlation cor() call fail with log(0) as input

2008-09-12 Thread Greg Snow
:03 PM To: Greg Snow Cc: r-help@r-project.org Subject: Re: [R] making spearman correlation cor() call fail with log(0) as input You are right, Inf and -Inf are not considered errors in R, they are accepted as input to Spearman's cor(), and so I will have to check the input myself

Re: [R] making spearman correlation cor() call fail with log(0) as input

2008-09-12 Thread Timur Shtatland
PROTECTED] Sent: Thursday, September 11, 2008 6:03 PM To: Greg Snow Cc: r-help@r-project.org Subject: Re: [R] making spearman correlation cor() call fail with log(0) as input You are right, Inf and -Inf are not considered errors in R, they are accepted as input to Spearman's cor

Re: [R] making spearman correlation cor() call fail with log(0) as input

2008-09-11 Thread Timur Shtatland
: [R] making spearman correlation cor() call fail with log(0) as input Hi, How can I make the cor(x, y, method=spearman) call to produce an error when the input to it (x, y) produces an error? Here is a simple example: a - c(0, 1, 2) b - c(100, 2, 4) ## error: log(a) [1] -Inf

[R] making spearman correlation cor() call fail with log(0) as input

2008-09-10 Thread Timur Shtatland
Hi, How can I make the cor(x, y, method=spearman) call to produce an error when the input to it (x, y) produces an error? Here is a simple example: a - c(0, 1, 2) b - c(100, 2, 4) ## error: log(a) [1] -Inf 0.000 0.6931472 ## error, as expected: cor(log(a), log(b), method=pearson)

Re: [R] making spearman correlation cor() call fail with log(0) as input

2008-09-10 Thread milton ruser
Hi Timur, try cor(log(a+1), log(b+1), method=pearson) HTH, miltinho brazil On Wed, Sep 10, 2008 at 6:04 PM, Timur Shtatland [EMAIL PROTECTED]wrote: Hi, How can I make the cor(x, y, method=spearman) call to produce an error when the input to it (x, y) produces an error? Here is a simple

Re: [R] making spearman correlation cor() call fail with log(0) as input

2008-09-10 Thread Greg Snow
Subject: [R] making spearman correlation cor() call fail with log(0) as input Hi, How can I make the cor(x, y, method=spearman) call to produce an error when the input to it (x, y) produces an error? Here is a simple example: a - c(0, 1, 2) b - c(100, 2, 4) ## error: log(a) [1] -Inf