Suresh_FSFM
2009-Feb-05 09:40 UTC
[R] help regarding storing time difference values in same unit?
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. Regards, Suresh -- 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.
jim holtman
2009-Feb-05 13:13 UTC
[R] help regarding storing time difference values in same unit?
If you are using 'difftime', you can specify the units:> x <- as.POSIXct(c('2009-01-01 10:00', '2009-03-04 13:00')) > x[1] "2009-01-01 10:00:00 GMT" "2009-03-04 13:00:00 GMT"> difftime(x[2], x[1])Time difference of 62.125 days> difftime(x[2], x[1], 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. > > Regards, > Suresh > > > > > -- > 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 > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?
Apparently Analagous Threads
- How to create sequence of constant time interval
- How to collect arrays in an array?
- How to print console output statements from within script or function?
- help regarding converting the available date in "right" date
- How to declare an array with columns storing different datatypes/precision