this is going to be a body of the particular Question.
which function we are using in array .
CodePudding user response:
You can find the index of the element by the functions which() or match()
Example for using which():
# vector created
v <- c(0, 1, 2, 3, 4,
5, 6, 7, 8, 9)
# which function is used
# to get the index
which(v == 5) # output is: 6
Example for using match():
# vector created
v <- c(0, 1, 2, 3, 4,
5, 6, 7, 8, 9)
# match function is
# used to get the index
match( 5 , v ) # output is: 6
You can see here more information
CodePudding user response:
For a matrix or an array, set the argument arr.ind = TRUE
:
which(myarray == 5, arr.ind = TRUE)