I was able to take a column of dates and times that looked like this <span class="Apple-style-span" style="border-collapse:separate"><span class="Apple-style-span" style="text-align:-webkit-left"><pre tabindex="0" class="GD40030CLR" style="font-family:'DejaVu Sans Mono';font-size:9pt!important;outline-style:none;outline-width:initial;outline-color:initial;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-width:initial;border-color:initial;white-space:pre-wrap!important;margin-top:0px;margin-bottom:0px;line-height:1.3">
2011 NOV18 09:29:16</pre><pre tabindex="0" class="GD40030CLR" style="font-family:'DejaVu Sans Mono';font-size:9pt!important;outline-style:none;outline-width:initial;outline-color:initial;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-width:initial;border-color:initial;white-space:pre-wrap!important;margin-top:0px;margin-bottom:0px;line-height:1.3">
<br></pre>I then tried this<pre tabindex="0" class="GD40030CLR" style="outline-style:none;outline-width:initial;outline-color:initial;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-width:initial;border-color:initial;margin-top:0px;margin-bottom:0px">
<span style="font-size:12px;line-height:15px;white-space:pre-wrap"><font face="'courier new', monospace"><a href="http://ape.ph">ape.ph</a>[,date:=IDateTime(strptime(<a href="http://ape.ph">ape.ph</a>$time,"%Y %b%d %H:%M:%S"))[[1]]]
<a href="http://ape.ph">ape.ph</a>[,timei:=as.ITime(strptime(<a href="http://ape.ph">ape.ph</a>$time,"%Y %b%d %H:%M:%S"))]</font></span></pre><pre tabindex="0" class="GD40030CLR" style="outline-style:none;outline-width:initial;outline-color:initial;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-width:initial;border-color:initial;margin-top:0px;margin-bottom:0px">
<font face="'DejaVu Sans Mono'"><span style="font-size:12px;line-height:15px;white-space:pre-wrap"><br></span></font></pre>I had to create one column called date to accept the first column of the IDateTime output. There does not appear to be a way to use the IDateTime function and take both of its columns and stick it into the data.table since one can only add one new column at a time as far as I can tell. Anyway, I then created a variable timei to accept the time.<br>
<br><br>I wanted to plot the times that something happened on the y axis and then on the x axis I wanted to have the various dates<pre tabindex="0" class="GD40030CLR" style="outline-style:none;outline-width:initial;outline-color:initial;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-width:initial;border-color:initial;margin-top:0px;margin-bottom:0px">
<font face="'DejaVu Sans Mono'"><span style="font-size:12px;line-height:15px;white-space:pre-wrap"><br></span></font></pre><font face="'courier new', monospace">library(ggplot2)<br>qplot(<a href="http://ape.ph">ape.ph</a>[,date], <a href="http://ape.ph">ape.ph</a>[,timei])</font><br>
<br><br>but alas I got this<br><br><br><font face="'courier new', monospace">Error in as.data.frame.default(x[[i]], optional = TRUE) : <br> cannot coerce class '"ITime"' into a data.frame</font></span></span><div>
<span class="Apple-style-span" style="border-collapse:separate"><span class="Apple-style-span" style="text-align:-webkit-left"><font face="'courier new', monospace"><br></font></span></span></div>I am eventually hoping for this<div>
<span class="Apple-style-span" style="border-collapse:separate"><span class="Apple-style-span" style="text-align:-webkit-left"><font face="'courier new', monospace"><div>qplot(<a href="http://ape.ph">ape.ph</a>[,date], <a href="http://ape.ph">ape.ph</a>[,timei]) + </div>
<div> scale_y_datetime(format="%H:%M:%S") +</div><div> xlab("Day") + ylab("Hour")</div></font><br><br>Do you have any examples of dates and times used in a data.table and then being used to plot graphs? I would love to see some examples. I could not find any<pre tabindex="0" class="GD40030CLR" style="outline-style:none;outline-width:initial;outline-color:initial;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-width:initial;border-color:initial;margin-top:0px;margin-bottom:0px">
<span class="Apple-style-span" style="border-collapse:separate"><pre tabindex="0" class="GD40030CLR" style="font-family:'DejaVu Sans Mono';font-size:9pt!important;outline-style:none;outline-width:initial;outline-color:initial;border-top-style:none;border-right-style:none;border-bottom-style:none;border-left-style:none;border-width:initial;border-color:initial;white-space:pre-wrap!important;margin-top:0px;margin-bottom:0px;line-height:1.3">
<span class="GD40030CGR"><br></span></pre></span></pre></span></span>Farrel Buchinsky<br>Google Voice Tel: (412) 567-7870<br><br>
</div>