From a0dce372b6041358ab562dbd044488bda21dc3ee Mon Sep 17 00:00:00 2001 From: Elias Projahn Date: Wed, 29 Dec 2021 16:09:18 +0100 Subject: [PATCH] ranking: Compute percentiles --- R/ranking.R | 5 +++-- man/ranking.Rd | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/R/ranking.R b/R/ranking.R index a28148c..233698b 100644 --- a/R/ranking.R +++ b/R/ranking.R @@ -8,8 +8,8 @@ #' methods that are contained within this list will be included. #' #' @returns A ranking object. The object extends the analysis result with -#' additional columns containing the `score` and the `rank` of each gene. It -#' will be ordered by rank. +#' additional columns containing the `score`, the `rank` and the `percentile` +#' for each gene. It will be ordered by rank. #' #' @export ranking <- function(analysis, weights) { @@ -36,6 +36,7 @@ ranking <- function(analysis, weights) { setorder(ranking, -score) ranking[, rank := .I] + ranking[, percentile := 1 - rank / nrow(ranking)] structure( ranking, diff --git a/man/ranking.Rd b/man/ranking.Rd index 93c7f39..9bed171 100644 --- a/man/ranking.Rd +++ b/man/ranking.Rd @@ -14,8 +14,8 @@ methods that are contained within this list will be included.} } \value{ A ranking object. The object extends the analysis result with -additional columns containing the \code{score} and the \code{rank} of each gene. It -will be ordered by rank. +additional columns containing the \code{score}, the \code{rank} and the \code{percentile} +for each gene. It will be ordered by rank. } \description{ This function takes the result of \code{\link[=analyze]{analyze()}} and creates a score by