[R] minimum from matrix

From: <oarabile_at_stams.strath.ac.uk>
Date: Tue, 08 May 2007 09:50:43 +0100

I have a very large matrix with columns that have some of their entries as zero

A small example if a=

         [,1]  [,2]  [,3]  [,4]

[,1] 0 2 0 0
[,2] 1 3 0 3
[,3] 2 0 3 5
[,4] 0 4 0 0

and what to get the minimum number from each column but that number should not be zero. If I use apply (a,2,min) I will get a vector of zeros as the minimum but what I want it for example from column 1 I should get 1 i.e for all the matrix I should get a vector (1,2,3,3). I wonder if someone can give an idea on how to go about it.

thanks in advance for your help.


R-help_at_stat.math.ethz.ch 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. Received on Tue 08 May 2007 - 11:53:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 08 May 2007 - 12:31:13 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.