Skip to content
Prev 301835 / 398506 Next

phantom NA/NaN/Inf in foreign function call (or something altogether different?)

On Tue, Jul 31, 2012 at 5:26 AM, Cecile De Cat <c.decat at leeds.ac.uk> wrote:
Not a complete answer, but complete.cases() won't pick up +/- Inf.

x <- data.frame(1:5, letters[1:5], c(NA, NaN, Inf, -Inf, 0))

x[complete.cases(x),]

You could perhaps use something like

sapply(x, is.finite)

with any()/all() to hunt them down (is.finite requires "real" numbers:
it gives false for NA, NaN, Inf, and -Inf).

Best,
Michael