ranking: Compute percentiles

This commit is contained in:
Elias Projahn 2021-12-29 16:09:18 +01:00
parent 48ff555e88
commit a0dce372b6
2 changed files with 5 additions and 4 deletions

View file

@ -8,8 +8,8 @@
#' methods that are contained within this list will be included. #' methods that are contained within this list will be included.
#' #'
#' @returns A ranking object. The object extends the analysis result with #' @returns A ranking object. The object extends the analysis result with
#' additional columns containing the `score` and the `rank` of each gene. It #' additional columns containing the `score`, the `rank` and the `percentile`
#' will be ordered by rank. #' for each gene. It will be ordered by rank.
#' #'
#' @export #' @export
ranking <- function(analysis, weights) { ranking <- function(analysis, weights) {
@ -36,6 +36,7 @@ ranking <- function(analysis, weights) {
setorder(ranking, -score) setorder(ranking, -score)
ranking[, rank := .I] ranking[, rank := .I]
ranking[, percentile := 1 - rank / nrow(ranking)]
structure( structure(
ranking, ranking,

View file

@ -14,8 +14,8 @@ methods that are contained within this list will be included.}
} }
\value{ \value{
A ranking object. The object extends the analysis result with A ranking object. The object extends the analysis result with
additional columns containing the \code{score} and the \code{rank} of each gene. It additional columns containing the \code{score}, the \code{rank} and the \code{percentile}
will be ordered by rank. for each gene. It will be ordered by rank.
} }
\description{ \description{
This function takes the result of \code{\link[=analyze]{analyze()}} and creates a score by This function takes the result of \code{\link[=analyze]{analyze()}} and creates a score by