[R] What is the matrix version of min()

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.be
Wed Sep 6 10:48:02 CEST 2006


you could use something like:

# for row min and max
apply(X, 1, min)
apply(X, 1, max)

# for column min and max
apply(X, 2, min)
apply(X, 2, max)


I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Tong Wang" <wangtong at usc.edu>
To: "R help" <r-help at stat.math.ethz.ch>
Sent: Wednesday, September 06, 2006 10:37 AM
Subject: [R] What is the matrix version of min()


> Hi,
>    Is there a function which operates on a matrix and return a 
> vector of min/max of each rol/col ?
> say,  X=  2,  1
>                3,  4
> min.col(X)=c(2,1)
>
> thanks a lot.
>
> tong
>
> ______________________________________________
> 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.
> 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



More information about the R-help mailing list