[datatable-help] A good way of using data.table with a date index

Matthew Dowle mdowle at mdowle.plus.com
Tue Jul 26 21:20:55 CEST 2011


Yes, great idea. Added new FR, thanks! :
https://r-forge.r-project.org/tracker/index.php?func=detail&aid=1482&group_id=240&atid=978

On Tue, 2011-07-26 at 15:07 -0400, Chris Neff wrote:
> Never would have found that on my own.  Could there possibly be a way
> to try that in the type coercion when a key gets set that is a date,
> time, or datetime class? I see no reason why key(x) = "date" should
> fail if all the things necessary to convert a date to something
> data.table is fine with exists.
> 
> On 26 July 2011 15:03, Matthew Dowle <mdowle at mdowle.plus.com> wrote:
>         Hi,
>         How about ?IDateTime.
>         Matthew
>         
>         
>         On Tue, 2011-07-26 at 14:07 -0400, Chris Neff wrote:
>         > Hi all,
>         >
>         >
>         > I often have a date index in a data frame that I don't
>         really care to
>         > keep as a time series because I don't do any sort of
>         smoothing or
>         > anything, but I prefer to keep it as a date class (or
>         POSIXct or
>         > whatever) so I can do things like only get data past a
>         certain date,
>         > or so plots will format correctly.
>         >
>         >
>         > I've found that any time I time to make a date class a key
>         variable it
>         > complains that it can't be converted to integer without
>         losing
>         > information. I've had to resort to saving them as factors
>         and then
>         > using as.POSIXct whenever i want them as dates, which is
>         annoying and
>         > error prone.
>         >
>         >
>         > Does anyone have a better way? POSIXct supports all standard
>         equality
>         > functions, and (I'm pretty sure) you can just convert into
>         unix
>         > seconds without losing anything, so why does it complain?
>         >
>         >
>         > -Chris
>         
>         > _______________________________________________
>         > datatable-help mailing list
>         > datatable-help at lists.r-forge.r-project.org
>         >
>         https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
>         
>         
> 




More information about the datatable-help mailing list