
In the following session, the output vector has an NA in the last position even though intervals are supposed to be
open-closed in cut: 

> dat <- seq(ISOdate(2003,6,28),length=5,by="days")
> cut(dat,dat[c(2,5)])
[1] <NA>                2003-06-29 08:00:00 2003-06-29 08:00:00
[4] 2003-06-29 08:00:00 <NA>               
Levels: 2003-06-29 08:00:00


In comparison, the workaround of removing the date class causes it
to work as expected, i.e. the last element of the result is not NA:

> cut(unclass(dat),unclass(dat[c(2,5)]))
[1] <NA>                    <NA>                    (1.0569e+09,1.0571e+09]
[4] (1.0569e+09,1.0571e+09] (1.0569e+09,1.0571e+09]
Levels: (1.0569e+09,1.0571e+09]

The following also works as expected:

> x <- 1:5
> cut(x,x[c(2,5)])
[1] <NA>  <NA>  (2,5] (2,5] (2,5]
Levels: (2,5]

as it does not have an NA in the last position.

I am using R 1.7.1 on Windows 2000. Is this a bug?


