R/nth_highest_val.R

Defines functions nth_highest_val

Documented in nth_highest_val

#' Function to extract the n-th highest value in a vector
#'
#' @param my_vector,n
#' @keywords indexing
#' @export
#' @examples
#' nth_highest_val(my_vector,n)

nth_highest_val <- function(my_vector,n){ # function to take the n-th highest value of a vector
  my_vec_sorted <- sort(my_vector, decreasing = TRUE)
  return(my_vec_sorted[n])
}
siggitrausti/siggitRausti documentation built on Sept. 9, 2020, 3:36 p.m.