Skip to content

na.omit (PR#610)

1 message · Douglas Bates

#
buerkle@hawaii.edu writes:
Well, because there is a bug in na.omit.default.  The problem is in the
section of code

        omit <- seq(along = object)[is.na(object)]
        nm <- names(object)
        object <- object[-omit]

If there are no NA's in the object, then omit becomes a length 0
vector and -omit doesn't have the intended effect.

A temporary fix would be to insert
        if (length(omit) == 0) return(object)
after the first line shown above.

We'll incorporate a fix for the next release.  Thanks for reporting
the bug.