Skip to content

Instantly share code, notes, and snippets.

@rukku
Created February 16, 2012 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rukku/1843333 to your computer and use it in GitHub Desktop.
Save rukku/1843333 to your computer and use it in GitHub Desktop.
Find the index for a value in an array
mat<-matrix(1:9,1,9)
which(mat==5,arr.ind=TRUE)
row col
[1,] 1 5
#from: http://r.789695.n4.nabble.com/How-do-I-find-the-index-for-a-value-in-an-array-td846012.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment