[R] How to find row maximum of two columns
Simon Blomberg
blomsp at ozemail.com.au
Thu May 11 06:07:01 CEST 2006
apply(tmax.m, 2, max)
Dale Steele wrote:
> Hello -- Given the 10x2 matrix below, my goal is to create a vector
> which contains the maximum of column 1 and column 2, or the only value
> if there is an NA in one column. I experimented with max.col without
> success. Thanks. --Dale
>
> > > tmax.m
> tmaxhme tmaxer
> [1,] 101.0 99.8
> [2,] 102.5 99.0
> [3,] 100.6 98.4
> [4,] NA 100.5
> [5,] 101.0 99.4
> [6,] NA 97.6
> [7,] NA 99.0
> [8,] 99.0 98.4
> [9,] NA 98.5
> [10,] NA 99.1
>
> ______________________________________________
> 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
>
>
--
Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat.
Centre for Resource and Environmental Studies
The Australian National University
Canberra ACT 0200
Australia
T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au
F: +61 2 6125 0757
CRICOS Provider # 00120C
More information about the R-help
mailing list