[R] Problem with seq.dates in chron

Waichler, Scott R Scott.Waichler at pnl.gov
Fri Sep 3 17:42:19 CEST 2004


I get faulty output from seq.dates() if I specify a length that is too
long.
For example, I ask for 129 months in the following call to the function,
but it returns
131:

> R.version.string
[1] "R version 1.9.1, 2004-06-21"
> startdatetime <- chron(dates="01/01/1995", times="00:00:00")
> beg.month.datetimes <- seq.dates(from=startdatetime, by="months",
length=129)
> beg.month.datetimes
  [1] 01/01/95 02/01/95 03/01/95 04/01/95 05/01/95 06/01/95 07/01/95
08/01/95
  [9] 09/01/95 10/01/95 11/01/95 12/01/95 01/01/96 02/01/96 03/01/96
04/01/96
 [17] 05/01/96 06/01/96 07/01/96 08/01/96 09/01/96 10/01/96 11/01/96
12/01/96
 [25] 01/01/97 02/01/97 03/01/97 04/01/97 05/01/97 06/01/97 07/01/97
08/01/97
 [33] 09/01/97 10/01/97 11/01/97 12/01/97 01/01/98 02/01/98 03/01/98
04/01/98
 [41] 05/01/98 06/01/98 07/01/98 08/01/98 09/01/98 10/01/98 11/01/98
12/01/98
 [49] 01/01/99 02/01/99 03/01/99 04/01/99 05/01/99 06/01/99 07/01/99
08/01/99
 [57] 09/01/99 10/01/99 11/01/99 12/01/99 01/01/00 02/01/00 03/01/00
04/01/00
 [65] 05/01/00 06/01/00 07/01/00 08/01/00 09/01/00 10/01/00 11/01/00
12/01/00
 [73] 01/01/01 02/01/01 03/01/01 04/01/01 05/01/01 06/01/01 07/01/01
08/01/01
 [81] 09/01/01 10/01/01 11/01/01 12/01/01 01/01/02 02/01/02 03/01/02
04/01/02
 [89] 05/01/02 06/01/02 07/01/02 08/01/02 09/01/02 10/01/02 11/01/02
12/01/02
 [97] 01/01/03 02/01/03 03/01/03 04/01/03 05/01/03 06/01/03 07/01/03
08/01/03
[105] 09/01/03 10/01/03 11/01/03 12/01/03 01/01/04 02/01/04 03/01/04
04/01/04
[113] 05/01/04 06/01/04 07/01/04 08/01/04 09/01/04 10/01/04 11/01/04
12/01/04
[121] 01/01/05 02/01/05 03/01/05 04/01/05 05/01/05 06/01/05 07/01/05
08/01/05
[129] 09/01/05 10/01/05 11/01/05
>

Is this a bug, and can it be fixed?

Scott Waichler
Pacific Northwest National Laboratory
scott.waichler<at>pnl.gov




More information about the R-help mailing list