Re: [R] Help on finding specific columns in matrix

2012-09-02 Thread arun
- >From: Andras Farkas >To: "r-help@r-project.org" >Cc: >Sent: Sunday, September 2, 2012 5:49 AM >Subject: [R] Help on finding specific columns in  matrix > >Dear All, >  >I have a matrix with 33 columns and 5000 rows. I would like to find 2 specific &g

Re: [R] Help on finding specific columns in matrix

2012-09-02 Thread arun
Hi, Try this:  which.min(apply(a,2,mean)) #[1] 1  which.max(apply(a,2,mean)) #[1] 4 A.K. - Original Message - From: Andras Farkas To: "r-help@r-project.org" Cc: Sent: Sunday, September 2, 2012 5:49 AM Subject: [R] Help on finding specific columns in matrix Dear All,

Re: [R] Help on finding specific columns in matrix

2012-09-02 Thread Rainer Schuermann
If I understand your question correctly, you want to identify the one column that has the lowest mean of all columns, and the one column that has the highest mean of all columns. Using your provided sample data, this gives you the indices: > colMeans(a) [1] 12.48160 17.46868 22.51761 27.59880 >

[R] Help on finding specific columns in matrix

2012-09-02 Thread Andras Farkas
Dear All,   I have a matrix with 33 columns and 5000 rows. I would like to find 2 specific columns in the set: the one that holds the highest values and the one that holds the lowest values. In this case the column's mean would be apropriate to use to try to find those specific columns because e