I have observed the following differences in the use of min/max functions between R and Splus (4.5) R (0.64.1): min(c(NA,NA,NA),na.rm=T) returns the following Warning in min(..., na.rm = na.rm) : no finite arguments to min/max; returning extreme. [1] 2147483647 S-Plus 4.5( Win32 edition) min(c(NA,NA,NA),na.rm=T) returns [1] NA The S-PLUS behaviour seems to be the right one Thanks, Athula. -- Athula Herath, PhD Oxford GlycoSciences,10, The Quadrant Abingdon Science Park, Abingdon, OXON OX14 3YS Email:Athula.Herath at ogs.co.uk Phone:+44 [0]1235 544202 FAX:+44 [0]1235 554701 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help 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-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

Athula> I have observed the following differences in the use of min/max Athula> functions between R and Splus (4.5) Athula> R (0.64.1): Athula> min(c(NA,NA,NA),na.rm=T) Athula> returns the following Athula> Warning in min(..., na.rm = na.rm) : no finite arguments to Athula> min/max; returning extreme. Athula> [1] 2147483647 Athula> S-Plus 4.5( Win32 edition) Athula> min(c(NA,NA,NA),na.rm=T) Athula> returns Athula> [1] NA Athula> The S-PLUS behaviour seems to be the right one Some of us disagree. One property of min()/max() should be the following: x , y : any (vector like) objects : min(x1,y,.., x2,...) == min(x1, min(y),.. min(x2),..) This property is fulfilled by R, but not by S-plus. The idea is that the logically entails min({empty}) = +Inf max({empty}) = -Inf and then min({empty},x) == min(x) = min(x, min({empty}) etc. Only problem being that "+/-Inf" for integers have to be coded as "+/- Max.Integer". --------- The only thing I could think of changing -- with some extra effort, unfortunately -- is the default type from "integer" to "numeric" ("double"). Reason why this seems to need quite an extra effort: Think of min(i1,i2,i3,i4, d1,...) where i* are integer (vectors) and d1 is a double one. The current implementation starts with integer type (and hence +Inf = +MaxInt) and only switches to double when 'd1' is encountered. Athula> Thanks, Athula> Athula. Athula> -- Athula Herath, PhD Oxford GlycoSciences,10, The Quadrant Athula> Abingdon Science Park, Abingdon, OXON OX14 3YS Athula> Email:Athula.Herath at ogs.co.uk Phone:+44 [0]1235 544202 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help 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-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._