[Rd] seq.default test for relative range (PR#1416)
macq@llnl.gov
macq@llnl.gov
Tue, 26 Mar 2002 19:01:07 +0100 (MET)
seq.default() tests for the relative range of the from and to
arguments (see excerpt below) and returns from (only) when the
relative range is small. The problem is that "small" is too large.
Also undocumented.
At 17:25 +0000 3/26/02, ripley@stats.ox.ac.uk wrote:
>On Tue, 26 Mar 2002, Don MacQueen wrote:
>
>> I was surprised when seq.POSIXt() returned a single value rather than
>> a vector, from inputs that I thought were reasonable. Here's an
>> example to illustrate:
>>
>> > t0 <- ISOdatetime(2002,6,24,0,0,10)
>>
>> ## expected a sequence of 16 times 1 second apart
>> > seq.POSIXt(from=t0,to=t0+15,by='1 sec')
>> [1] "2002-06-24 00:00:10 PDT"
>>
>> ## traces to this call
>> > seq.default(1024902010,1024902025,by=1)
>> [1] 1024902010
>> >
>>
>> ## which is due to the following expressions in seq.default()
>> del <- to - from
>> ## a few lines omitted
>> dd <- abs(del)/max(abs(to), abs(from))
>> if (dd < sqrt(.Machine$double.eps)) return(from)
>>
>> This looks like a trap to catch bad input, and return something
>> reasonable (or at least not crash).
>>
>> It's a given that seq.default() pre-dates seq.POSIXt() by many years,
>> and the test for relative range undoubtedly has good reasons, so it's
>> probably not a good idea to change seq.default().
>
>Oh, I think it needs to be changed. That is far too generous a test for
>numerical inaccuracies, by say 5 orders of magnitude. It is also
>undocumented, so I'd post a bug report on seq.default.
>
Remainder of my original post to R-help and Prof. Ripley's response
not included in bug report. Subject line was "seq.POSIXt() with short
time intervals" on 2002-03-26 if anyone wants to see the whole of it.
-Don
--
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
--------------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._