[R] Return the matrix location of multiple entries
connollj
connollj at uoguelph.ca
Mon Jan 23 18:41:37 CET 2012
Hello!
I'm working with a matrix called 'subER'. This matrix has 150(=h) rows and
15 columns. What I would like to do is have a command that will identify the
minimum 4 values in each row and return the column numbers where these
values were found. My hope is to store this information in a new 150 by 4
matrix called P.
So far I've only been able to get R to identify one minimum value and return
its corresponding column location:
P=matrix(nrow=h, ncol=1)
for(i in 1:h){
P[i,]=which.min(subER[i,])
}
Any help would be greatly appreciated!!
Thank you in advance,
Jess
--
View this message in context: http://r.789695.n4.nabble.com/Return-the-matrix-location-of-multiple-entries-tp4321412p4321412.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list