**Problem :**

I have done a lot of research on this extensively without finding any solution on it. I have tried cleaning my data set as follows:

library("myraster")

impute.mean <- function(l) replace(l, is.na(l) | is.nan(l) | is.infinite(l) ,

mean(l, na.rm = TRUE))

losses <- apply(losses, 2, impute.mean)

colSums(is.na(losses))

isinf <- function(l) (NA <- is.infinite(l))

infout <- apply(losses, 2, is.infinite)

colSums(infout)

isnan <- function(l) (NA <- is.nan(l))

nanout <- apply(losses, 2, is.nan)

colSums(nanout)

But the problem arises while running the predict algorithm:

options(warn=2)

p <- predict(default.rf, losses, type="prob", inf.rm = TRUE, na.rm=TRUE, nan.rm=TRUE)

All my research says it should be NA's or Inf's or NaN's in the data but I don't have any