multi.which | R Documentation |
A which for multidimensional arrays
multi.which(A)
A |
Array of booleans |
sum(A) x length(dim(A)) array of multi-indices where A == TRUE
Mark van der Loo 16.09.2011
https://www.r-bloggers.com/2011/09/a-multidimensional-which-function/
example code set.seed(83) ar3 <- array(rbinom(20,1,0.5), dim = c(4,5)) ar3
ar3[1,1] <- 2 ar3[2,1] <- 2 ar3[1,2] <- 2 ar3[3,4] <- 2 ar3[2,5] <- 2 ar3[4,5] <- 2
ar3
which(ar3 == 2) multi.which(ar3 == 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.