I was able to take a column of dates and times that looked like this

2011 NOV18 09:29:16


I then tried this

ape.ph[,date:=IDateTime(strptime(ape.ph$time,"%Y %b%d
%H:%M:%S"))[[1]]]ape.ph[,timei:=as.ITime(strptime(ape.ph$time,"%Y %b%d
%H:%M:%S"))]


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.


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


library(ggplot2)
qplot(ape.ph[,date], ape.ph[,timei])


but alas I got this


Error in as.data.frame.default(x[[i]], optional = TRUE) :
cannot coerce class '"ITime"' into a data.frame

I am eventually hoping for this
qplot(ape.ph[,date], ape.ph[,timei]) +
   scale_y_datetime(format="%H:%M:%S") +
           xlab("Day") + ylab("Hour")


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


Farrel Buchinsky
Google Voice Tel: (412) 567-7870
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

Reply via email to