Re: [R] Time Interval calculation using R

2008-10-05 Thread jim holtman
Seems to work fine for me: > times <- c("10:12:34", "14:23:15") > Ptime <- as.POSIXct(strptime(times, "%H:%M:%S")) > > Ptime [1] "2008-10-05 10:12:34 GMT" "2008-10-05 14:23:15 GMT" > difftime(Ptime[2], Ptime[1], units='min') Time difference of 250.6833 mins > You just have to be careful that all

Re: [R] Time Interval calculation using R

2008-10-04 Thread Yihui Xie
You seem to have omitted a left quotation mark in (2): %H:%M:%S". Regards, Yihui -- Yihui Xie <[EMAIL PROTECTED]> Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086 Mobile: +86-15810805877 Homepage: http://www.yihui.name School of Statistics, Room 1037, Mingde Main Building, Renmin University of Ch

[R] Time Interval calculation using R

2008-10-04 Thread Gouri Shankar Mishra
Hi I have two columns of data with time in form of HH:MM:SS - representing start time and end time of an activity. I am trying to calculate the time difference (duration of the activity). (1) I first tried > difftime(btime, etime, units = "mins") This however gave me the error - Error in as.POSIX