R/which_maximum.R

#' Which Maximum
#'
#' Wrapper for which.max function that can handle NA (return NA)
#'
#' @noRd
#'
#' @author David Navega
#' @param x numeric (logical, integer or double) vector or R object.
#'
#' @return the index of the maximum element.
#'
#' @seealso \code{\link{which.max}}
#'
which_maximum <- function(x) {
  if(any(is.na(x))){
    NA
  } else {
    which.max(x)
  }
}
dsnavega/imputeForest documentation built on May 8, 2019, 2:43 p.m.