HI Andras,
No problem.  
But, i guess using colMeans() as suggested by Rainer should be faster in large 
datasets.

A.K.

----- Original Message -----
From: Andras Farkas <motyoc...@yahoo.com>
To: smartpink...@yahoo.com
Cc: 
Sent: Sunday, September 2, 2012 4:59 PM
Subject: Re: [R] Help on finding specific columns in  matrix




this works nicely, thanks arun...

Andras

------------------------------
On Sun, Sep 2, 2012 11:50 AM EDT arun wrote:

>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 <motyoc...@yahoo.com>
>To: "r-help@r-project.org" <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 
>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 each columns mean is 
>different and they all change together based on the same "change of rate 
>constants" as a function of time (ie: tme is the most important determinant of 
>the magnitude of that mean).  The columns are not to be named, if possible.... 
>Any thoughts on that? Would apreciate the help....
> 
>example:
> 
>a 
><-matrix(c(runif(500,10,15),runif(500,15,20),runif(500,20,25),runif(500,25,30)),ncol=4)
> 
>I would need to find and plot with a box percentile plot column 1, the column 
>with the lowest mean, and column 4, the column with the highest mean
> 
>thanks,
> 
>Andras 
>    [[alternative HTML version deleted]]
>
>
>______________________________________________
>R-help@r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to