Skip to content
Prev 263497 / 398502 Next

problem (and solution) to rle on vector with NA values

Hello Cormac.

Not having thoroughly checked whether your code actually works, the behavior
of rle you describe is the one documented (check the details of ?rle) and
makes sense as the missingness could have different reasons.
As such, changing this type of behavior would probably break a lot of
existing code that is built on top of rle.

There are other peculiarities and disputabilities about some base R
functions (the order of the arguments for sample trips me every time), but
unless the argument is really strong or a downright bug, I doubt people will
be willing to change this. Perhaps making the new behavior optional (through
a new parameter na.action or similar, with the default the original
behavior) is an option?

Feel free to run your own version of rle in any case. I suggest you rename
it, though, as it may cause problems for some packages.


Nick Sabbe
--
ping: nick.sabbe at ugent.be
link: http://biomath.ugent.be
wink: A1.056, Coupure Links 653, 9000 Gent
ring: 09/264.59.36

-- Do Not Disapprove