s-news
[Top] [All Lists]

extract row name of matrix

To: s-news@lists.biostat.wustl.edu
Subject: extract row name of matrix
From: Sarah Henderson <sarah.henderson@ubc.ca>
Date: Wed, 05 Oct 2005 13:38:01 -0500

Hello to all --

My apologies for what I know to be an elementary question, but cannot seem to find the answer to.

I would like to extract the row name of a matrix where the third column has it's maximum value. I know that dimnames(matrix)[1] gives the row names and that max(matrix[,3]) gives the maximum in the third column, but I just can't figure out how to put the two together. I tried dimnames(matrix)[1[max(matrix)[,3]] but that didn't work.

A point in the right direction would be much appreciated. I'm using S-Plus 6.2 in Windows.

Thanks,

Sarah


<Prev in Thread] Current Thread [Next in Thread>