#' 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)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.