calculating time difference in R
You must turn your strings into date objects before you can do date/time arithmetic. Try this: a) Reading your data: R> dat <- read.table(textConnection(“start.date start.time end.date end.time 2012-07-13 15:01:32 2012-07-13 15:02:42 2012-07-05 18:26:31 2012-07-05 18:27:19 2012-07-14 20:23:21 2012-07-14 20:24:11”), header=TRUE) b) Working on one observation: R> strptime( paste(dat[,1], dat[,2]), “%Y-%m-%d %H:%M:%S”) [1] “2012-07-13 15:01:32” “2012-07-05 … Read more