Dinesh.hmn Dinesh.hmn - 1 year ago 166
R Question

Difference in dates using sqldf in R

I have two columns in a data frame where I need to calculate the difference in time. The data is the local PD data from open data of cities. One column is below

01/01/2011 12:00:37 AM

01/01/2011 12:21:31 AM

Also the TimeArrival as a few missing values as every dispatch does not need the cops to arrive.

I am trying to find the difference using sqldf in R but it says this error

Error in sqliteSendQuery(conn, statement, bind.data) :
RAW() can only be applied to a 'raw', not a 'double'
In addition: Warning message:
In sqliteSendQuery(con, statement, bind.data) :
Closing result set with pending rows

Any help guys?

Answer Source

I actually found the answer. Just convert the difftime variable to an integer using as.integer(). I read numerous blogs and I could not find the answer anywhere so I am posting the answer for future reference

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download