powered by
keypos returns the positions of the (fact table) elements that participate in their sorted unique subset (dimension table)
keypos
keypos(x, ...)# S3 method for integer64 keypos(x, method = NULL, ...)
# S3 method for integer64 keypos(x, method = NULL, ...)
an integer vector of the same length as x containing positions relative to sort(unique(x), na.last=FALSE)
x
sort(unique(x), na.last=FALSE)
a vector or a data frame or an array or NULL.
NULL
ignored
NULL for automatic method selection or a suitable low-level method, see details
NAs are sorted first in the dimension table, see ramorder.integer64().
ramorder.integer64()
This function automatically chooses from several low-level functions considering the size of x and the availability of a cache.
Suitable methods are
sortorderkey (fast ordering)
sortorderkey
orderkey (memory saving ordering).
orderkey
unique.integer64() for the unique subset and match.integer64() for finding positions in a different vector.
unique.integer64()
match.integer64()
x <- as.integer64(sample(c(rep(NA, 9), 1:9), 32, TRUE)) keypos(x) stopifnot(identical(keypos(x), match.integer64(x, sort(unique(x), na.last=FALSE))))
Run the code above in your browser using DataLab