s-news
[Top] [All Lists]

Re: S4 class timeDate

To: Frank E Harrell Jr <fharrell@virginia.edu>
Subject: Re: S4 class timeDate
From: Prof Brian Ripley <ripley@stats.ox.ac.uk>
Date: Mon, 23 Jun 2003 16:00:56 +0100 (BST)
Cc: s-news <s-news@lists.biostat.wustl.edu>
In-reply-to: <20030623105333.12cf4c58.fharrell@virginia.edu>
concat(x, x) appears to work.

On Mon, 23 Jun 2003, Frank E Harrell Jr wrote:

> How does one get the following to work properly in S-Plus 6?
> 
> > x <- timeDate(julian=0:10)
> > x
>  [1] 01/01/1960 01/02/1960 01/03/1960 01/04/1960 01/05/1960 01/06/1960
>  [7] 01/07/1960 01/08/1960 01/09/1960 01/10/1960 01/11/1960
> > c(x,x)
> [[1]]:
> [[1]][[1]]:
>  [1]  0  1  2  3  4  5  6  7  8  9 10
> 
> [[1]][[2]]:
>  [1] 0 0 0 0 0 0 0 0 0 0 0
> 
> 
> [[2]]:
> [1] "julian.day"   "milliseconds"
> 
> [[3]]:
> [1] "integer" "integer"
> 
> [[4]]:
> [1] "%02m/%02d/%Y"
> 
> . . .
> 
> POSIX date/times in R, which use S3 methods, do not have this problem:
> 
> > x <- ISOdate(year=1960,month=1,day=1:10)
> > x
>  [1] "1960-01-01 07:00:00 EST" "1960-01-02 07:00:00 EST"
>  [3] "1960-01-03 07:00:00 EST" "1960-01-04 07:00:00 EST"
>  [5] "1960-01-05 07:00:00 EST" "1960-01-06 07:00:00 EST"
>  [7] "1960-01-07 07:00:00 EST" "1960-01-08 07:00:00 EST"
>  [9] "1960-01-09 07:00:00 EST" "1960-01-10 07:00:00 EST"
> > c(x,x)
>  [1] "1960-01-01 07:00:00 EST" "1960-01-02 07:00:00 EST"
>  [3] "1960-01-03 07:00:00 EST" "1960-01-04 07:00:00 EST"
>  [5] "1960-01-05 07:00:00 EST" "1960-01-06 07:00:00 EST"
>  [7] "1960-01-07 07:00:00 EST" "1960-01-08 07:00:00 EST"
>  [9] "1960-01-09 07:00:00 EST" "1960-01-10 07:00:00 EST"
> [11] "1960-01-01 07:00:00 EST" "1960-01-02 07:00:00 EST"
> [13] "1960-01-03 07:00:00 EST" "1960-01-04 07:00:00 EST"
> [15] "1960-01-05 07:00:00 EST" "1960-01-06 07:00:00 EST"
> [17] "1960-01-07 07:00:00 EST" "1960-01-08 07:00:00 EST"
> [19] "1960-01-09 07:00:00 EST" "1960-01-10 07:00:00 EST"
> 
> Neither do chron objects in S-Plus 6, which also use S3 methods:
> 
> > x <- chron(0:10)
> > x
>  [1] 01/01/60 01/02/60 01/03/60 01/04/60 01/05/60 01/06/60 01/07/60 01/08/60
>  [9] 01/09/60 01/10/60 01/11/60
> > c(x,x)
>  [1] 01/01/60 01/02/60 01/03/60 01/04/60 01/05/60 01/06/60 01/07/60 01/08/60
>  [9] 01/09/60 01/10/60 01/11/60 01/01/60 01/02/60 01/03/60 01/04/60 01/05/60
> [17] 01/06/60 01/07/60 01/08/60 01/09/60 01/10/60 01/11/60
> 
> ---
> Frank E Harrell Jr              Prof. of Biostatistics & Statistics
> Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences
> U. Virginia School of Medicine  http://hesweb1.med.virginia.edu/biostat
> --------------------------------------------------------------------
> This message was distributed by s-news@lists.biostat.wustl.edu.  To
> unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
> the BODY of the message:  unsubscribe s-news
> 

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


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