#' @author Eric Coissac
#' @author Christelle Gonindard-Melodelima
#' @export
na.omit.procmod.frame=function (object, ...)
{
  n <- length(object)
  omit <- logical(nrow(object))
  vars <- seq_len(n)
  for (j in vars) {
    x <- object[[j]]
    omit= omit | rowSums(is.na(x))>0
  }
  xx <- object[!omit, , drop = FALSE]
  if (any(omit > 0L)) {
    temp <- setNames(seq(omit)[omit], attr(object, "row.names")[omit])
    attr(temp, "class") <- "omit"
    attr(xx, "na.action") <- temp
  }

  return(xx)
}

#' @author Eric Coissac
#' @author Christelle Gonindard-Melodelima
#' @export
na.exclude.procmod.frame=function(object, ...) {
  xx = na.omit.procmod.frame(object, ...)
  na.action = attr(xx, "na.action")
  if (! is.null(na.action)) {
    class(na.action)="exclude"
    attr(xx, "na.action")=na.action
  }

  return(xx)
}
