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

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Wed, 09 Jun 2010 11:59:36 -0400

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 2 1
2000 Q3 3 2
2000 Q4 4 3
2001 Q1 5 4
2001 Q2 6 5
2001 Q3 NA 6

On Wed, Jun 9, 2010 at 10:09 AM, Johann Hibschman <jhibschman_at_gmail.com> wrote:
> Gabor Grothendieck <ggrothendieck@gmail.com> 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 attempt to reinvent q/kdb+ in R.)
>
> I've had some problems with yearmon's conversions in the past, so I'm
> (probably unfairly) suspicious of the approach of storing dates as
> floats.  To be fair, once I reported the bug, it was fixed almost
> immediately; I was very impressed.
>
>> 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.
>
> Thanks, that's a very useful example.  I don't understand all of what's
> going on in there, but I find it easier to understand the documentation
> with an example in hand.
>
> Cheers,
> Johann
>
> ______________________________________________
> R-devel_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed 09 Jun 2010 - 16:01:29 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 09 Jun 2010 - 16:41:00 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive