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.<br>
<br><div class="gmail_quote">On 26 July 2011 15:03, Matthew Dowle <span dir="ltr"><<a href="mailto:mdowle@mdowle.plus.com">mdowle@mdowle.plus.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
How about ?IDateTime.<br>
Matthew<br>
<div><div></div><div class="h5"><br>
On Tue, 2011-07-26 at 14:07 -0400, Chris Neff wrote:<br>
> Hi all,<br>
><br>
><br>
> I often have a date index in a data frame that I don't really care to<br>
> keep as a time series because I don't do any sort of smoothing or<br>
> anything, but I prefer to keep it as a date class (or POSIXct or<br>
> whatever) so I can do things like only get data past a certain date,<br>
> or so plots will format correctly.<br>
><br>
><br>
> I've found that any time I time to make a date class a key variable it<br>
> complains that it can't be converted to integer without losing<br>
> information. I've had to resort to saving them as factors and then<br>
> using as.POSIXct whenever i want them as dates, which is annoying and<br>
> error prone.<br>
><br>
><br>
> Does anyone have a better way? POSIXct supports all standard equality<br>
> functions, and (I'm pretty sure) you can just convert into unix<br>
> seconds without losing anything, so why does it complain?<br>
><br>
><br>
> -Chris<br>
</div></div>> _______________________________________________<br>
> datatable-help mailing list<br>
> <a href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a><br>
> <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a><br>
<br>
<br>
</blockquote></div><br>