Re: [Rd] ?setGeneric garbled (PR#14153)

2009-12-18 Thread maechler
> "RossB" == Ross Boylan > on Thu, 17 Dec 2009 09:42:22 -0800 writes: RossB> On Thu, 2009-12-17 at 15:24 +0100, Martin Maechler wrote: >> > Ross Boylan >> > on Thu, 17 Dec 2009 02:15:12 +0100 (CET) writes: >> >> > Full_Name: Ross Boylan >> > Versi

Re: [Rd] apparently incorrect p-values from 2-sided Kolmogorov-Smirnov test (PR#14145)

2009-12-18 Thread tlumley
I've fixed this by adding 0.5/mn to q. The problem (at least in principle) with multiplying them all up is integer overflow. By the time 0.5/mn underflows to zero, missing one value in the distribution won't matter. -thomas On Fri, 18 Dec 2009, David John Allwright wrote: Dear Thoma

Re: [Rd] apparently incorrect p-values from 2-sided Kolmogorov-Smirnov (PR#14158)

2009-12-18 Thread tlumley
I've fixed this by adding 0.5/mn to q. The problem (at least in principle) with multiplying them all up is integer overflow. By the time 0.5/mn underflows to zero, missing one value in the distribution won't matter. -thomas On Fri, 18 Dec 2009, David John Allwright wrote: > Dear Tho

Re: [Rd] apparently incorrect p-values from 2-sided Kolmogorov-Smirnov (PR#14157)

2009-12-18 Thread allwrigh
Dear Thomas, Right, thank you. Yes, I haven't looked at the source code (because I don't know C) but something like what you mention could well cause the kind of problems I am seeing: a loop being exectued one too few or one too many times. And yes, I think those quantities should be multiplied

[Rd] Vectorized switch

2009-12-18 Thread Stavros Macrakis
What is the 'idiomatic' way of writing a vectorized switch statement? That is, I would like to write, e.g., vswitch( c('a','x','b','a'), a= 1:4, b=11:14, 100 ) => c(1, 100, 13, 4 ) equivalent to ifelse(

Re: [Rd] Vectorized switch

2009-12-18 Thread Gabriel Becker
My understanding is that all the really fast vectorized operations are implemented down in C code, not in R. Thus if you wanted to write a vectorized switch, which I agree would be rather nice to have, you'd need to do it down there and then write a .Call wrapper for it in R. The ifelse (C) code w

Re: [Rd] Vectorized switch

2009-12-18 Thread William Dunlap
> -Original Message- > From: r-devel-boun...@r-project.org > [mailto:r-devel-boun...@r-project.org] On Behalf Of Stavros Macrakis > Sent: Friday, December 18, 2009 11:07 AM > To: r-devel@r-project.org > Subject: [Rd] Vectorized switch > > What is the 'idiomatic' way of writing a vectorize

Re: [Rd] Vectorized switch

2009-12-18 Thread Stavros Macrakis
On Fri, Dec 18, 2009 at 2:39 PM, William Dunlap wrote: > > colchoose( data.frame(a=1:4,b=11:14), c('a','b','b','a')) > >=> c(1,11,11,1) > > I thought you would want c(1,12,13,4), not c(1,11,11,1), > out of this call. Perhaps I misunderstand your requirements. > Sorry, you're r

Re: [Rd] Vectorized switch

2009-12-18 Thread tlumley
On Fri, 18 Dec 2009, Gabriel Becker wrote: My understanding is that all the really fast vectorized operations are implemented down in C code, not in R. Thus if you wanted to write a vectorized switch, which I agree would be rather nice to have, you'd need to do it down there and then write a .Ca

Re: [Rd] Vectorized switch

2009-12-18 Thread Gabriel Becker
On Fri, Dec 18, 2009 at 11:49 AM, wrote: > On Fri, 18 Dec 2009, Gabriel Becker wrote: > > My understanding is that all the really fast vectorized operations are >> implemented down in C code, not in R. Thus if you wanted to write a >> vectorized switch, which I agree would be rather nice to have