[R] Time difference between two dates/timing

R. Michael Weylandt michael.weylandt at gmail.com
Thu Jun 14 17:06:37 CEST 2012


You have been asked before (by me!) to give reproducible examples
using dput()...

You might need the diff() function.

Michael

On Thu, Jun 14, 2012 at 5:08 AM, Rantony <antony.akkara at ge.com> wrote:
> Hi,
>
>
> Here, i have a matrix like this
>
> MyMatrix <-
>
> *DATETIME        HEADER1            HEADER2*
> 1/1/2010 0:10   197.1947                     100.0859
> 1/1/2010 0:20   203.8811                     100.1013
> 1/1/2010 0:30   206.564               100.0433
> 1/1/2010 0:40   207.9563                       99.9393
>
> i want to get the time difference in minutes between two date.
>
> TimeDiff <- MyMatrix[1,1] -  MyMatrix[2,1]
> TimeDiff <- 10 (need to get like this )
>
> Could you please help me ?
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Time-difference-between-two-dates-timing-tp4633353.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.



More information about the R-help mailing list