Skip to content
Prev 5820 / 63421 Next

Suggestion: min(...,na.rm=T)

On Wed, 11 Jul 2001, Agustin Lobo wrote:

            
It turns out that both NA and numeric(0) have disadvantages.  The problem with numeric(0) is that min() usually returns a vector of length 1 and doing comparisons like (min(x)<max(y)) would lead to an error if one of them had zero length. In many ways NA is the obvious result and is what S does, but using Inf has the effect that max(c(x,y)) is always the same as max(x,max(y)) and similar things. 

The result is more elegant with real numbers where the result is the IEEE Inf not just the largest number. Another minor advantage is that it automatically gives the correct nonparametric confidence intervals for quantiles as having infinite limits.
 

          -thomas




-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Message-ID: <Pine.LNX.4.33.0107110757350.25476@hymn03.u.washington.edu>
In-Reply-To: <pine.osf.3.96.1010711131757.20936c_100000@paleo.ija.csic.es>