prank: (P)ercent (Rank)s

Description Usage Arguments Details Value Author(s) See Also Examples

Description

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

Usage

1
2
3
	prank(x, ...)
	## S3 method for class 'integer64'
prank(x, method = NULL, ...)

Arguments

x

a integer64 vector

method

NULL for automatic method selection or a suitable low-level method, see details

...

ignored

Details

Function prank.integer64 is based on rank.integer64.

Value

prank returns a numeric vector of the same length as x.

Author(s)

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

See Also

rank.integer64 for simple ranks and qtile for the inverse function quantiles.

Examples

1
2
3
4
5
x <- as.integer64(sample(c(rep(NA, 9), 1:9), 32, TRUE))
prank(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

 [1]         NA         NA 0.69444444 0.02777778         NA         NA
 [7]         NA 0.44444444 0.19444444         NA 0.02777778         NA
[13] 0.19444444 0.44444444 0.69444444         NA 0.11111111 0.30555556
[19] 0.69444444 1.00000000         NA 0.69444444 0.44444444 0.69444444
[25] 0.30555556         NA         NA         NA 0.91666667         NA
[31] 0.69444444 0.91666667

bit64 documentation built on May 2, 2019, 4:49 p.m.