[R] comparing matrices using max or min

stephen sefick ssefick at gmail.com
Thu Nov 6 16:59:52 CET 2008

#how about this
A <- rnorm(10)
B <- rnorm(10)
C <- rnorm(10)

D <- data.frame(A,B,C)

apply(D, MARGIN=1, FUN=min)

On Thu, Nov 6, 2008 at 10:00 AM, Diogo André Alagador
<mcnda839 at mncn.csic.es> wrote:
> Dear all,
> I have 3 matrices with the same dimension, A,B,C and I would like to produce
> a matrix D where in each position would retrieve the max(or min) value along
> A,B,C taken from the same position.
> I guess that apply functions should fit, but for matrices objects I am not
> getting it.
> thanks in advance,
> Diogo André Alagador
>        [[alternative HTML version deleted]]
> ______________________________________________
> R-help at 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.

Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

								-K. Mullis

More information about the R-help mailing list