s-news
[Top] [All Lists]

[S] times in chron() function

To: s-news@wubios.wustl.edu
Subject: [S] times in chron() function
From: Jean_Adams@usgs.gov (Jean Adams)
Date: Thu, 23 Dec 1999 10:57:47 -0700
Sender: owner-s-news@wubios.wustl.edu
The times that are output from the chron() function appear to be different 
depending on whether or not you associate a date with them.  Check out the 
example below.

library(chron)

mdy <- scan(what="")
"May/17/1983" "May/29/1983" "Jun/12/1983" "Jun/27/1983" "Jul/10/1983"
"Jul/13/1983" "Jul/19/1983" "May/29/1983" "Jun/25/1983" "Jul/5/1983"
"Jul/11/1983" "Jul/18/1983" "May/26/1983" "Jun/24/1983" "Jun/29/1983"
"Jul/19/1983" "Apr/28/1983" "Jun/6/1983"  "Jun/21/1983" "Jul/9/1983" 

hms <- scan(what="")
"16:00:00" "09:30:00" "12:00:00" "08:00:00" "08:00:00" "12:00:00" "08:00:00"
"13:00:00" "09:30:00" "08:00:00" "08:00:00" "09:00:00" "08:00:00" "08:00:00"
"08:00:00" "08:00:00" "10:00:00" "08:00:00" "08:00:00" "09:00:00"

> chron(times=hms)
 [1] 16:00:00 09:30:00 12:00:00 08:00:00 08:00:00 12:00:00
 [7] 08:00:00 13:00:00 09:30:00 08:00:00 08:00:00 09:00:00
[13] 08:00:00 08:00:00 08:00:00 08:00:00 10:00:00 08:00:00
[19] 08:00:00 09:00:00
> chron(mdy, hms)
 [1] (05/17/83 15:59:59) (05/29/83 09:30:00) (06/12/83 12:00:00)
 [4] (06/27/83 08:00:00) (07/10/83 08:00:00) (07/13/83 12:00:00)
 [7] (07/19/83 08:00:00) (05/29/83 12:59:59) (06/25/83 09:30:00)
[10] (07/05/83 08:00:00) (07/11/83 08:00:00) (07/18/83 09:00:00)
[13] (05/26/83 08:00:00) (06/24/83 08:00:00) (06/29/83 08:00:00)
[16] (07/19/83 08:00:00) (04/28/83 09:59:59) (06/06/83 08:00:00)
[19] (06/21/83 08:00:00) (07/09/83 09:00:00)

Why does 16:00:00 get changed to 15:59:59?  Why do only 10:00:00, 13:00:00, and 
16:00:00 (in this example) get changed, while the other on-the-hour times 
(08:00:00, 09:00:00, and 12:00:00) remain unchanged?

I am using S-PLUS 2000 Professional Release 2 on Windows NT.

Please respond to me, and I will summarize to the group.

Thanks.

JVA


`·.,,  ><(((º>   `·.,,  ><(((º>   `·.,,  ><(((º>   `·.,,  ><(((º>

Jean V. Adams
USGS - Great Lakes Science Center
1451 Green Road
Ann Arbor, MI 48105-2807  U.S.A.
phone:  (734) 214-9307
FAX:    734-994-8780
e-mail: jean_adams@usgs.gov

-----------------------------------------------------------------------
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>
  • [S] times in chron() function, Jean Adams <=