[R] Subtract Date Between columns

Jim Holtman jholtman at gmail.com
Thu Mar 15 12:26:39 CET 2012


use POSIXct instead

Sent from my iPad

On Mar 15, 2012, at 6:21, MSousa <ricardosousa2000 at clix.pt> wrote:

> Hello 
> 
>   I have this little dataset, my goal is create one column in the
> data.frame with between the diference DataTime and Duration.
>  I'm using the next code to make do this
> 
> TIME_STAMP   SESSIONTIME    Time                  TimeStart
> 1162343932    8320            2006-10-31 19:01:34       2006-10-31 16:42:54
> 1162343215    592         2006-10-31 19:02:04       2006-10-31 18:52:12
> 1162341465    11875         2006-10-31 19:02:27       2006-10-31 15:44:32
> 1162339324    118           2006-10-31 19:03:01       2006-10-31 19:03:03
> 1162339381    2
> 
> Dataset$Time<-as.POSIXlt(TIME_STAMP, origin="1970-01-01",
> tz="America/New_York")
> temp1<-Dataset$Time-Dataset$SESSIONTIME
> Dataset$TimeStart<-as.POSIXlt(temp1, origin="1970-01-01",
> tz="America/New_York")
> 
> 
>  I don't understand why changed the data in column TimeStar on 4 register
> 
>   Thanks
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/Subtract-Date-Between-columns-tp4474466p4474466.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