Re: [Rd] prod(numeric(0)) surprise

From: Simon Urbanek <simon.urbanek_at_r-project.org>
Date: Mon 09 Jan 2006 - 21:04:06 GMT

On Jan 9, 2006, at 3:35 PM, Kjetil Halvorsen wrote:

> But this thread seems to have pointed to some inconsistencies:
>
>> cumprod( numeric(0) )
> numeric(0)
>> cumsum( numeric(0) )
> numeric(0)
>
> shouldn't this give the same as prod() and sum() in this case?

No - as Thomas explained very nicely they are a different kind of functions. cumXXX are n-to-n length vector functions, whereas prod/ sum are n to 1 vector length functions. So R is in fact very consistent and Thomas did exactly describe the rules.

Cheers,
Simon



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue Jan 10 08:09:50 2006

This archive was generated by hypermail 2.1.8 : Tue 10 Jan 2006 - 04:08:33 GMT