powered by
Calculates array indices based on their vector position in an array.
arrayInd(ind, .dim, .dimnames = NULL, useNames = FALSE)
integer-valued vector of indices.
integer vector givine dimensions of array.
optional list of character dimnames(.), of which only .dimnames[[1]] is used.
dimnames(.)
.dimnames[[1]]
logical indicating if the value of arrayInd() should have (non-null) dimnames at all.
arrayInd()
A matrix whose rows each are the indices of one element of x; see Examples below.
x
This is a C implementation of the base function of the same name. Results should be the same.
C
base
Given a vector of integers giving the vector position of entries in an array, returns the appropriate array indices.
The base version, documented as which.
which
# NOT RUN { arr = array(1:36, dim=c(2,3,2,3)) ind = arrayInd(c(4,9,17), c(2,3,2,3)) ind arr[2,2,1,1] arr[1,2,2,1] arr[1,3,1,2] # }
Run the code above in your browser using DataLab