The date-based functions in S-PLUS 2000 (and in S-PLUS 4.5) all perform
computations in whole days, and expect whole-day input, as Guy Nason has
discovered. Behaviour with non-integer Julian date inputs isn't defined in
the help files. A tongue-in-cheek response would be that integer Julian
dates are defined as one second before midnight on that day (making Guy's
results consistent), but I think we should just prevent non-integer inputs
to month.day.year (and document the function as such).
Computations involving dates and times (or fractional dates, if you prefer)
are possible with timeDate objects in S-PLUS 5 on Unix; this facility will
also be included in the forthcoming S-PLUS 6 for Windows. Support for time
zones is also included.
# David Smith
--
David M Smith <dsmith@splus.mathsoft.com>
S-PLUS Product Manager, MathSoft DAPD, Seattle WA
Tel: +1 (206) 283 8802 x360
Fax: +1 (206) 283 0347
> -----Original Message-----
> From: owner-s-news@wubios.wustl.edu
> [mailto:owner-s-news@wubios.wustl.edu]On Behalf Of Guy Nason
> Sent: Tuesday, May 30, 2000 10:40
> To: s-news
> Subject: [S] Interesting behaviour of month.day.year
>
>
> Hello,
>
> The following behaviour was achieved with S-Plus 4.5 Release 2 running
> on Windows 98.
>
> #
> # First create a Julian date for 31st March 2000
> #
>
> jd <- julian(m=3, d=31, y=2000)
> jd
> # [1] 14700
> #
> # The function month.day.year works correctly on this
> #
> month.day.year(14700)
> #$month:
> #[1] 3
> #
> #$day:
> #[1] 31
> #
> #$year:
> #[1] 2000
> #
> # Now how about 14700.3
> #
> month.day.year(14700.3)
> #$month:
> #[1] 4
> #
> #$day:
> #[1] 1
> #
> #$year:
> #[1] 2000
> #
> Note that the month has changed to APRIL! This probably IS NOT a bug
> since I should think the dates functions are only defined for
> integers.
> However, I've been writing an application that uses decimal days for
> hours. So my "practical" interpretation is that 14700.3 is 0.3 of the
> way through 31st March 2000.
>
> S-Plus refers to some original code to Becker, Chambers and
> Wilks (1988)
> which is present in the examples() library. I think I can see
> where the
> 0.25 comes from (in the first multiplication by 4).
>
> Any comments,
> Guy
>
> ps: I did check through the archive but didn't see anything on this.
> Probably nobody is crazy enough to do this....
>
>
>
>
>
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
|