[R] If(cond) statement

Johannes Hüsing johannes at huesing.name
Tue Apr 29 22:59:52 CEST 2008

Beck, Kenneth (STP) <Kenneth.Beck at bsci.com> [Tue, Apr 29, 2008 at 07:21:40PM CEST]:

> mxx=max(cpx_list$nMV);
> mxy=max(trend_list$nMV);
> if (mxx>mxy)
>   mxy=mxx
> else
>   mxx=mxy

Can't this be replaced by
mxx <- max(c(cpx_list$nMV, trend_list$nMV))
mxy <- mxx

Johannes Hüsing               There is something fascinating about science. 
                              One gets such wholesale returns of conjecture 
mailto:johannes at huesing.name  from such a trifling investment of fact.                
http://derwisch.wikidot.com         (Mark Twain, "Life on the Mississippi")

More information about the R-help mailing list