search for: unwhich

Displaying 1 result from an estimated 1 matches for "unwhich".

Did you mean: nwhich
2001 Jul 06
1
Inverse function to 'which'?
Is there an inverse function to 'which' available, which creates a logical vector/matrix from indices? I wrote my own, but if there is a standard function I would like to use that instead. Example: x <- c(TRUE, TRUE, FALSE, TRUE, FALSE, FALSE) unwhich(which(x)) # [1] TRUE TRUE FALSE TRUE unwhich(which(x), length(x)) # [1] TRUE TRUE FALSE TRUE FALSE FALSE y <- matrix(x, nrow=3, ncol=2) unwhich(which(y, arr.ind=TRUE)) # "Minimum" size unwhich(which(y, arr.ind=TRUE), dim(y)) # Same dimensions as y Thanks Henrik...