On Thu, 28 Jun 2007 16:19:39 -0400,
"Afshartous, David" <[EMAIL PROTECTED]> wrote:

> All,

> Is there one liner way to obtain the max per observation for two
> vectors?  I looked at apply and lapply but it seems that groundwork
> would have to be done before applying either of those.  The code below
> does it but seems like overkill.

> Thanks!  Dave

> x = rnorm(10) y = rnorm(10)

> ind = which(x < y) z = x z[ind] <- y[ind] ## z now contains the max's

?pmax


-- 
Seb

______________________________________________
R-help@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.

Reply via email to