I'm trying to run a randomForest on a large-ish data set (5000x300). Unfortunately I'm getting an error message as follows:
> RF <- randomForest(prePrior1, postPrior1[,6]
Error in randomForest.default(prePrior1, postPrior1[, 6], , do.trace = TRUE, :
NA/NaN/Inf in foreign function call (arg 1)
> df2 <- prePrior1[is.na(prePrior1)]
> df2 <- postPrior1[is.na(postPrior1[,6])]
You're probably looking for
is.finite, though I'm not 100% certain that the problem is Infs in your input data.
Be sure to read the help for
is.finite carefully about which combinations of missing, infinite, etc. it picks out. Specifically, this:
> is.finite(c(1,NA,-Inf,NaN))  TRUE FALSE FALSE FALSE > is.infinite(c(1,NA,-Inf,NaN))  FALSE FALSE TRUE FALSE
One of these things is not like the others. Not surprisingly, there's an
is.nan function as well.