R/get_cum_perc_abund.R

#' get_cum_perc_abund
#'
#' This internal function arranges percent abundances from least to greatest and computes
#' their cumulative percent abundances. It is called by get_25perc_groups.
#'
#' @param data a tibble containing the following column name: "perc_abund"
#'
#' @importFrom rlang .data
#'
#' @return data with a new column containing the cumulative percent abundances
#' @export
get_cum_perc_abund <- function (data) {
  data %>%
    dplyr::arrange(.data$perc_abund) %>%
    dplyr::mutate(cum_perc_abund = cumsum(.data$perc_abund))
}
robertyoung3/MSanalyzeNOM documentation built on June 7, 2021, 7:46 a.m.