Re: [Rd] Extract/format/show for S4 objects (Johann Hibschman)

2010-06-09 Thread Daniel Murphy
Johann, Following up on Gabor's reply, the mondate package (new on CRAN last week) will accomplish your needs. >I'm trying to make an integer-backed quarter (as in fraction of year) >class, but I can't quite it to work. I want integer-backed so I don't >have to worry about floating-point effects

Re: [Rd] Extract/format/show for S4 objects

2010-06-09 Thread Gabor Grothendieck
Note that zoo's merge can handle that: >> library(zoo) > z <- zooreg(1:6, as.yearqtr("2000 Q1")) > merge(z, zlag = lag(z1, -1)) z zlag 2000 Q1 1 NA 2000 Q2 21 2000 Q3 32 2000 Q4 43 2001 Q1 54 2001 Q2 65 2001 Q3 NA6 On Wed, Jun 9, 2010 at 10:09 AM, Johann

Re: [Rd] Extract/format/show for S4 objects

2010-06-09 Thread Johann Hibschman
Gabor Grothendieck writes: > The yearqtr class already rounds off automatically to avoid floating > point effects and handles #1 and #2. The main use for all this was so I could use quarters as index columns with data.table, which demands integer storage mode. (This is part of my ongoing attemp

Re: [Rd] Extract/format/show for S4 objects

2010-06-09 Thread Jeffrey J. Hallman
The tis package has the ti (TimeIndex) class that does what you want, and I modestly think it's nicer than the zoo stuff. As for S4 classes, there's a good reason many of us don't use them: they're too inflexible and hard to program with. I wouldn't go there unless I really had to. Johann Hibsc

Re: [Rd] Extract/format/show for S4 objects

2010-06-08 Thread Gabor Grothendieck
The yearqtr class already rounds off automatically to avoid floating point effects and handles #1 and #2. On the other hand if you are just interested in playing around with S4 for its own sake review the source code of the mondate package as an example of an S4 based date package. On Tue, Jun 8,

[Rd] Extract/format/show for S4 objects

2010-06-08 Thread Johann Hibschman
Hi all, I'm trying to make an integer-backed quarter (as in fraction of year) class, but I can't quite it to work. I want integer-backed so I don't have to worry about floating-point effects when doing math, and so that I can use it as in data.table. First of all, is there a good reference for t