Convert indices to logical vector
Gives a logical vector which is TRUE for the indices provided
invwhich(ix, n = max(if (is.numeric(ix)) ix, length(nm)), nm)
ix |
an vector of indices |
n |
the length of the output vector; defaults to the maximum index |
nm |
(optional) names for the vector |
a logical vector of length n
and names nm
If nm
is specified, ix
may be a character vector instead.
Rather than using a useNames
logical to copy the names attribute from
one vector to another, you may specify names via the nm
argument.
Nick Sabbe, Neal Fultz
x <- rnorm(50) > 1 ix <- which(x) all.equal(x, invwhich(ix, 50)) all.equal( invwhich(grep('O', state.abb), 50), grepl('O', state.abb) )
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.