# [R] `its' questions

Martin Maechler maechler at stat.math.ethz.ch
Fri Aug 27 15:51:26 CEST 2004

```>>>>> "Ajay" == Ajay Shah <ajayshah at mayin.org>
>>>>>     on Fri, 27 Aug 2004 16:08:40 +0530 writes:

Ajay> Problem 1: Often, when I'm dealing with its, str() breaks. Here's a
Ajay> bug demo. The first statements work fine --

Ajay> library(its)

Ajay> # Make a series of all dates from 1/1/2000 to 10/1/2000; fill this up
Ajay> # with integers from 1 to 30
Ajay> x1 <- newIts(start="2000-01-01", end="2000-01-10", 1:30, ncol=3)
Ajay> print(x1)
Ajay> # Do the same, but restrict yourself to weekdays only
Ajay> x2 <- newIts(start="2000-01-01", end="2000-01-10", 1:30, ncol=3,
Ajay>    extract=T, weekday=T)
Ajay> print(x2)

Ajay> str(x1)    # works

Ajay> But here it breaks --
>> str(x2)
Ajay> Error in object[1:ile] : subscript out of bounds

be it an its bug or not,  str() shouldn't "break".

-- and it doesn't anymore in "R-devel" (aka "R 2.0.0 unstable").
There, str() has been enhanced (several weeks ago) to nicely
display S4 class objects, and for the above it returns

> str(x2)
Formal class 'its' [package "its"] with 3 slots
..@ dim     : int [1:2] 6 3
..@ dimnames:List of 2
.. ..\$ : chr [1:6] "2000-01-03" "2000-01-04" "2000-01-05" "2000-01-06" ...
.. ..\$ : chr [1:3] "1" "2" "3"
..@ dates   :`POSIXct', format: chr [1:6] "2000-01-03 01:00:00" "2000-01-04 01:00:00" "2000-01-05 01:00:00" "2000-01-06 01:00:00" ...

---

Martin Maechler

```