Skip to content
Prev 28478 / 63468 Next

prod(0, 1:1000) ; 0 * Inf etc

On Mon, 21 Apr 2008, Mathieu Ribatet wrote:

            
That would fail for prod(0,Inf), which should return the same
thing as 0*Inf=NaN.  Similarly for prod(0,NA) and prod(0,NaN).
Scanning for all these things might well be slower than just
doing the multiplications.  Scanning also means that 0 is treated
more commutatively than other numbers.
c() can convert values of classy objects in undesirable ways.
E.g.,
   > now<-Sys.time()
   > min(now-file.info(".")$mtime, now-file.info("..")$mtime)
   Time difference of 3787.759 secs
   > min(c(now-file.info(".")$mtime, now-file.info("..")$mtime))
   [1] 1.052155

This may be considered a bug in c(), at least for class
"timediff" (and  "factor" and "ordered"), but c() removes
attributes.
----------------------------------------------------------------------------
Bill Dunlap
Insightful Corporation
bill at insightful dot com
360-428-8146

 "All statements in this message represent the opinions of the author and do
 not necessarily reflect Insightful Corporation policy or position."