R/percentile_rank.R

Defines functions percentile_rank

Documented in percentile_rank

#' Creates the percentile rank of a vector.
#'
#' @param x A numeric column.
#' @return The input percentile ranked (vector).
#' @examples
#' percentile_rank(seq(1:10))
percentile_rank <- function(x) trunc(rank(x, na.last = "keep")) / sum(!is.na(x))
ndtallant/tidytallant documentation built on Feb. 5, 2020, 1:19 p.m.