s-news
[Top] [All Lists]

[S] Interesting behaviour of month.day.year

To: s-news <s-news@wubios.wustl.edu>
Subject: [S] Interesting behaviour of month.day.year
From: Guy Nason <G.P.Nason@bristol.ac.uk>
Date: Tue, 30 May 2000 18:39:41 +0100
Organization: University of Bristol
Reply-to: G.P.Nason@bristol.ac.uk
Sender: owner-s-news@wubios.wustl.edu
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....




Attachment: G.P.Nason.vcf
Description: Card for Guy Nason

<Prev in Thread] Current Thread [Next in Thread>