# qtile: (Q)uan(Tile)s In bit64: A S3 Class for Vectors of 64bit Integers

## Description

Function `prank.integer64` projects the values [min..max] via ranks [1..n] to [0..1]. `qtile.ineger64` is the inverse function of 'prank.integer64' and projects [0..1] to [min..max].

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14``` ``` qtile(x, probs=seq(0, 1, 0.25), ...) ## S3 method for class 'integer64' qtile(x, probs = seq(0, 1, 0.25), names = TRUE, method = NULL, ...) ## S3 method for class 'integer64' quantile(x, probs = seq(0, 1, 0.25), na.rm = FALSE, names = TRUE, type=0L, ...) ## S3 method for class 'integer64' median(x, na.rm = FALSE, ...) ## S3 method for class 'integer64' mean(x, na.rm = FALSE, ...) ## S3 method for class 'integer64' summary(object, ...) ## mean(x, na.rm = FALSE, ...) ## or ## mean(x, na.rm = FALSE) ```

## Arguments

 `x` a integer64 vector `object` a integer64 vector `probs` numeric vector of probabilities with values in [0,1] - possibly containing `NA`s `names` logical; if `TRUE`, the result has a `names` attribute. Set to `FALSE` for speedup with many probs. `type` an integer selecting the quantile algorithm, currently only 0 is supported, see details `method` NULL for automatic method selection or a suitable low-level method, see details `na.rm` logical; if `TRUE`, any `NA` and `NaN`'s are removed from `x` before the quantiles are computed. `...` ignored

## Details

Functions `quantile.integer64` with `type=0` and `median.integer64` are convenience wrappers to `qtile`.
Function `qtile` behaves very similar to `quantile.default` with `type=1` in that it only returns existing values, it is mostly symetric but it is using 'round' rather than 'floor'.
Note that this implies that `median.integer64` does not interpolate for even number of values (interpolation would create values that could not be represented as 64-bit integers).
This function automatically chooses from several low-level functions considering the size of `x` and the availability of a cache. Suitable methods are `sortqtl` (fast sorting) and `orderqtl` (memory saving ordering).

## Value

`prank` returns a numeric vector of the same length as `x`.
`qtile` returns a vector with elements from `x` at the relative positions specified by `probs`.

## Author(s)

Jens Oehlschlägel <Jens.Oehlschlaegel@truecluster.com>

`rank.integer64` for simple ranks and `quantile` for quantiles.

## Examples

 ```1 2 3 4 5 6 7 8``` ```x <- as.integer64(sample(c(rep(NA, 9), 1:9), 32, TRUE)) qtile(x, probs=seq(0, 1, 0.25)) quantile(x, probs=seq(0, 1, 0.25), na.rm=TRUE) median(x, na.rm=TRUE) summary(x) x <- x[!is.na(x)] stopifnot(identical(x, unname(qtile(x, probs=prank(x))))) ```

### Example output

```Loading required package: bit
Attaching package bit
package:bit (c) 2008-2012 Jens Oehlschlaegel (GPL-2)
creators: bit bitwhich
coercion: as.logical as.integer as.bit as.bitwhich which
operator: ! & | xor != ==
querying: print length any all min max range sum summary
bit access: length<- [ [<- [[ [[<-
for more help type ?bit

Attaching package: 'bit'

The following object is masked from 'package:base':

xor

Attaching package bit64
package:bit64 (c) 2011-2012 Jens Oehlschlaegel
creators: integer64 seq :
coercion: as.integer64 as.vector as.logical as.integer as.double as.character as.bin
logical operator: ! & | xor != == < <= >= >
arithmetic operator: + - * / %/% %% ^
math: sign abs sqrt log log2 log10
math: floor ceiling trunc round
querying: is.integer64 is.vector [is.atomic} [length] format print str
values: is.na is.nan is.finite is.infinite
aggregation: any all min max range sum prod
cumulation: diff cummin cummax cumsum cumprod
access: length<- [ [<- [[ [[<-
combine: c rep cbind rbind as.data.frame
WARNING don't use as subscripts
WARNING semantics differ from integer
for more help type ?bit64

Attaching package: 'bit64'

The following object is masked from 'package:bit':

still.identical

The following objects are masked from 'package:base':

%in%, :, is.double, match, order, rank

integer64
0%  25%  50%  75% 100%
1    3    5    7    9
integer64
0%  25%  50%  75% 100%
1    3    5    7    9
integer64
 5
integer64
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's
1       3       5       4       7       9      15
```

bit64 documentation built on Aug. 30, 2020, 9:07 a.m.