unwhich {bazar} | R Documentation |
Quasi-inverse of the 'which' function
Description
The unwhich
function is a kind of inverse
of the which
function.
Usage
unwhich(w, n)
Arguments
w |
A vector of integers; morally the result of a call to |
n |
integer. The length of the result; morally the length of the
|
Value
A logical vector of length n
.
See Also
Examples
x1 <- c(TRUE, FALSE, TRUE, TRUE)
x2 <- unwhich(which(x1), length(x1))
identical(x1, x2) # TRUE
w1 <- c(2, 4, 5, 1, 1)
w2 <- which(unwhich(w1, 10))
identical(sort(unique(as.integer(w1))), w2) # TRUE
[Package bazar version 1.0.11 Index]