[R] spline bug ?
Martin Maechler
maechler at stat.math.ethz.ch
Fri Oct 4 22:13:35 CEST 2002
>>>>> "Bruce" == Bruce L <mail at fwr.on.ca>
>>>>> on Fri, 4 Oct 2002 15:17:51 -0400 writes:
Bruce> The bug reported above for "spline" is probably related to a similar problem with sequencing in POSIX dates.
Bruce> For example this works ok:
>> seq(from=1,to=4,out.length=4)
Bruce> [1] 1 2 3 4
Bruce> But the following gives an output length of five, not four:
>> seq(from=ISOdate(2000,1,1),to=ISOdate(2000,1,4),length.out=4)
Bruce> [1] "2000-01-01 07:00:00 EST" "2000-01-02 01:00:00 EST"
Bruce> [3] "2000-01-02 19:00:00 EST" "2000-01-03 13:00:00 EST"
Bruce> [5] "2000-01-04 07:00:00 EST"
Bruce> Surely this is a bug?
indeed. Thanks a lot for reducing the problem so far!
The bug is in seq.POSIXct()
and here is the fix -- soon to appear in "R-patched" snapshots.
Index: src/library/base/R/datetime.R
===================================================================
RCS file: /home/rdevel/CVS-ARCHIVE/R/src/library/base/R/datetime.R,v
retrieving revision 1.35.2.1
retrieving revision 1.35.2.2
diff -w -r1.35.2.1 -r1.35.2.2
461,462c461,464
< incr <- (to - from)/length.out
< res <- seq.default(from, to, incr)
---
> ## Till (and incl.) 1.6.0 :
> ##- incr <- (to - from)/length.out
> ##- res <- seq.default(from, to, incr)
> res <- seq.default(from, to, length.out = length.out)
Martin Maechler <maechler at stat.math.ethz.ch> http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum LEO C16 Leonhardstr. 27
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND
phone: x-41-1-632-3408 fax: ...-1228 <><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list