R/calculatePercentiles.R

Defines functions calculatePercentiles

Documented in calculatePercentiles

#' Calculate percentiles
#'
#' Calculate the percentiles of a row in a tibble.
#'
#' @param tibRow a row in a tibble; the row need not contain all the columns of the tibble.
#' @param tib a tibble.
#'
#' @return The percentiles of each of the input columns.
#' @export
#'
#' @examples
calculatePercentiles <- function(tibRow, tib) {
  vars <- colnames(tibRow)
  sapply(vars, function(var){ecdf(tib[[var]])(tibRow[[var]])})
}
Timothy-Barry/coproanalysis documentation built on Feb. 12, 2020, 7:33 a.m.