# irank_against: Compute integer ranks in another reference vector In danielwilhelm/R-CS-ranks: Statistical Tools for Ranks

 irank_against R Documentation

## Compute integer ranks in another reference vector

### Description

The method `irank` compares ranks using the same vector as reference. This method returns ranks, that values from `x` would assume if (individually) inserted into `v`.

### Usage

``````irank_against(x, v, omega = 0, increasing = FALSE, na.rm = FALSE)

frank_against(x, v, omega = 0, increasing = FALSE, na.rm = FALSE)
``````

### Arguments

 `x` numeric query vector. `v` numeric reference vector. `omega` numeric value in [0,1], defining how ties in `x` (if any) are handled; default is `0`. See Details. `increasing` logical; if `FALSE` (default), then large elements in `x` receive a small rank. Otherwise, large elements in `x` receive a large rank. `na.rm` logical; if `TRUE`, then `NA`'s are removed from `x`. Default: `FALSE`.

### Details

This function implements all possible definitions of ranks of the values in `x`. Different definitions of the ranks are chosen through combinations of the two arguments `omega` and `increasing`. Suppose `x` is of length `p`. If `increasing=TRUE`, then the largest value in `x` receives the rank `p` and the smallest the rank `1`. If `increasing=FALSE`, then the largest value in `x` receives the rank `1` and the smallest the rank `p`.

The value of `omega` indicates how ties are handled. If there are no ties in `x`, then the value of `omega` does not affect the ranks and the only choice to be made is whether the ranks should be increasing or decreasing with the values in `x`. When there are ties in `x`, however, then there are infinitely many possible ranks that can be assigned to a tied value.

When `increasing=TRUE`, then `omega=0` leads to the smallest possible and `omega=1` to the largest possible rank of a tied value. Values of `omega` between 0 and 1 lead to values of the rank between the largest and smallest.

### Value

Integer vector of the same length as `x` containing the ranks.

### Functions

• `frank_against()`: Compute integer ranks in another reference vector

### Examples

``````irank_against(1:10, c(4,4,4,3,1,10,7,7))
``````

danielwilhelm/R-CS-ranks documentation built on Sept. 25, 2023, 6:08 a.m.