[R] help regarding storing time difference values in same unit?
jholtman at gmail.com
Thu Feb 5 14:13:08 CET 2009
If you are using 'difftime', you can specify the units:
> x <- as.POSIXct(c('2009-01-01 10:00', '2009-03-04 13:00'))
 "2009-01-01 10:00:00 GMT" "2009-03-04 13:00:00 GMT"
> difftime(x, x)
Time difference of 62.125 days
> difftime(x, x, units='secs')
Time difference of 5367600 secs
On Thu, Feb 5, 2009 at 4:40 AM, Suresh_FSFM <suresh.ghalsasi at gmail.com> wrote:
> Dear R-Experts,
> Seek your help.
> In a List object e.g. Time_duration[], I am storing differece between two
> time-stamps (start-time and end-time) for a certain event.
> Time difference does not remain constant for, say, 10 observations.
> Each time, the time difference is given in different time units: seconds /
> hours / minutes.
> Can you please tell me - how I can store the values of time difference in
> just one time unit ?
> It can be either seconds, or minutes or hours. The criterion is - unit
> should be consistent.
> Thank you in advance.
> View this message in context: http://www.nabble.com/help-regarding-storing-time-difference-values-in-same-unit--tp21847883p21847883.html
> Sent from the R help mailing list archive at Nabble.com.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
+1 513 646 9390
What is the problem that you are trying to solve?
More information about the R-help