Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

tiepos

Extract Positions of Tied Elements


Description

tiepos returns the positions of those elements that participate in ties.

Usage

tiepos(x, ...)
## S3 method for class 'integer64'
tiepos(x, nties = NULL, method = NULL, ...)

Arguments

x

a vector or a data frame or an array or NULL.

nties

NULL or the number of tied values (including NA). Providing nties can speed-up when x has no cache. Note that a wrong nties can cause undefined behaviour up to a crash.

method

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

...

ignored

Details

This function automatically chooses from several low-level functions considering the size of x and the availability of a cache. Suitable methods are sortordertie (fast ordering) and ordertie (memory saving ordering).

Value

an integer vector of positions

Author(s)

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

See Also

rank.integer64 for possibly tied ranks and unipos.integer64 for positions of unique values.

Examples

x <- as.integer64(sample(c(rep(NA, 9), 1:9), 32, TRUE))
tiepos(x)

stopifnot(identical(tiepos(x),  (1:length(x))[duplicated(x) | rev(duplicated(rev(x)))]))

bit64

A S3 Class for Vectors of 64bit Integers

v4.0.5
GPL-2 | GPL-3
Authors
Jens Oehlschlägel [aut, cre], Leonardo Silvestri [ctb]
Initial release
2020-08-29

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.