search for: namaskval

Displaying 1 result from an estimated 1 matches for "namaskval".

2011 Jun 23
3
problem (and solution) to rle on vector with NA values
...?? y <- x[-1L] != x[-n] in line 7 of the rle function body. In this test, NA values return logical NA values, not TRUE/FALSE (again, unsurprising). Resolution: I modified the rle function code as included below. As far as I tested, this modification appears safe. The convoluted construction of naMaskVal should guarantee that the NA masking value is always different from any value in the vector and should be safe regardless of the input vector form (a raw vector is not handled since the NA values do not apply here). rle<-function (x) { ??? if (!is.vector(x) && !is.list(x)) ??????? stop(...