Thank you SO MUCH for all of your help!
I got wonderful answers....don't you just love this news group?
Here are some of the replies:
z1 <- w[order(w[,3])[1],]
w[((1:nrow(w))[w[,3] == min(w[,3]])[1],]
w[w[,3] == min(w[,3]),drop=F][1,]
z1 <- w[match(min(w[,3]),w[,3],nomatch=0), ]
Sincerely,
Erin Hodgess
Assistant Professor
Dept. of Computer and Mathematical Sciences
University of Houston -- Downtown
e-mail: hodgess@uhdux2.dt.uh.edu
Dear S+ers
I am using S+ version 4 on Windows 95 PC.
Here is my question, please.
I have an n x 3 matrix, called w. In matrix w, I have 3 columns,
alpha, beta, and sigma. I would like to find the minimum of
w[,3], and copy that row. If the minimum occurs more than once,
the first row is enough.
I have a solution, but I believe that a more "elegant" solution
is possible. Here is my "ok" solution.
a1 <- w[,3] == min(w[,3])
z1 <- w[a1,]
z1 <- z1[1,]
Then the vector z1 contains the first row where the minimum is found.
It works, but is ugly.
Any help would be much appreciated.
Sincerely,
Erin Hodgess
Assistant Professor
Dept. of Computer and Mathematical Sciences
University of Houston -- Downtown
e-mail: hodgess@uhdux2.dt.uh.edu
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news