On 4/7/06, Sasha email@example.com wrote:
- I am not sure cumprod and cumsum should fill masked elements with 1 and
- I would think the result should be masked if any prior element along the
axis being accumulated is masked. To ignore masked elements, filled can be called explicitly before cum[prod|sum]. One of the problems with filling by default is that 1 or 0 are not appropriate values for object arrays (for example, "" is an appropriate fill value for cumsum of an array of strings).
There are often a number of options for how masked values can be dealt with. In general (not just with cum*), I would prefer for the result to be masked when masked values are involved unless I explicitly indicate what should be done with the masked values. Otherwise it is too easy to forget that some default maniputlation of masked values has been applied. In R there is commonly an na.action or na.rm parameter to functions.