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

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 lo

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

2008-09-12 Thread Timur Shtatland
r > Intermountain Healthcare > [EMAIL PROTECTED] > (801) 408-8111 > > > > > -Original Message- > > From: Timur Shtatland [mailto:[EMAIL PROTECTED] > > Sent: Thursday, September 11, 2008 6:03 PM > > To: Greg Snow > > Cc: r-help@r-project.org > &g

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

2008-09-12 Thread Greg Snow
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'

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

2008-09-11 Thread Timur Shtatland
lp@r-project.org" > Sent: 9/10/08 3:51 PM > 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 erro

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

2008-09-10 Thread Greg Snow
/10/08 3:51 PM 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

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

2008-09-10 Thread Timur Shtatland
Hi Miltinho, Thank you for the reply. I know that this is one way to stop cor(log()...) from failing. However, my question was exactly the opposite: how to *make* it fail. cor() silently succeeds and even returns a value even when the input to it fails on its own (e.g., log(0) fails). Note that

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

[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="p