[R] Matrix max by row

Wacek Kusnierczyk Waclaw.Marcin.Kusnierczyk at idi.ntnu.no
Sun Mar 29 01:21:37 CET 2009


Ana M Aparicio Carrasco wrote:
> I need help about how to obtain the max by row in a matrix.
> For example if I have the following matrix:
> 2 5 3
> 8 7 2
> 1 8 4
>
> The max by row will be:
> 5
> 8
> 8
>   

matrix(apply(m, 1, max), nrow(m))

vQ




More information about the R-help mailing list