s-news
[Top] [All Lists]

RE: [S] Interesting behaviour of month.day.year

To: G.P.Nason@bristol.ac.uk, s-news <s-news@wubios.wustl.edu>
Subject: RE: [S] Interesting behaviour of month.day.year
From: Winnie Lambert <lambert.winifred@ensco.com>
Date: Tue, 30 May 2000 15:37:30 -0400
Sender: owner-s-news@wubios.wustl.edu
Guy,

My understanding of the Julian calender is that it is used to calculate day
numbers only without regard to time of day.  Therefore, you are correct in
saying the the julian() fuction does not have a bug.  MS Excel has a
function like you describe, in which fractions of a day represent the time
of day.  Your comments on "where the 0.25 comes from" are rather cryptic to
me.  Did you find a function in S-PLUS that behaves the same way as your
application and that in Excel?  I am going to need a function like that and
was going to attempt to build one, unless you or anyone else can tell me
that one exists.  Anyone?

Win Lambert

P.S.  For an interesting discussion on the history and function of the
Julian and Gregorian calendars, refer to The Bulletin of the American
Meteorological Society, Volume 81 No. 1, January 2000, pp 69-74, "Calendars
and Software" by Jon E. Ahlquist.  Your company or university library should
be able to get a copy for you if they don't have the journal.


-----Original Message-----
From: Guy Nason [mailto:G.P.Nason@bristol.ac.uk]
Sent: Tuesday, May 30, 2000 1:40 PM
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

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