> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of sugo
> Sent: Wednesday, September 02, 2009 4:51 PM
> To: r-help@r-project.org
> Subject: [R] diff of two timestamps
>
>
> Hi all,
>
> I hav
Try this:
dat <- read.table(textConnection("Timestamp1 Timestamp2
05:24:43 05:25:05
15:47:02 15:47:22
18:36:05 18:36:24
15:21:24 15:22:04"), T)
closeAllConnections()
Reduce("-", lapply(dat, strptime, format = "%H:%M:%S"))
On Wed, Sep 2, 2009 at 8:50 PM, sugo wrote:
>
> Hi all,
>
> I have the f
Try
require(chron)
dat <- read.table(textConnection("Timestamp1 Timestamp2
05:24:43 05:25:05
15:47:02 15:47:22
18:36:05 18:36:24
15:21:24 15:22:04"), T)
closeAllConnections()
str(dat)
dat[,1] <- times(dat[,1])
dat[,2] <- times(dat[,2])
# numeric
as.numeric(dat[,2] <- times(dat[,2]) )
# test t
Try this:
> Lines <- "Timestamp1;Timestamp2;
+ 05:24:43;05:25:05;
+ 15:47:02;15:47:22;
+ 18:36:05;18:36:24;
+ 15:21:24;15:22:04;"
>
> library(chron)
> DF <- read.csv(textConnection(Lines), sep = ";", as.is = TRUE)
> times(DF$Timestamp2) - times(DF$Timestamp1)
[1] 00:00:22 00:00:20 00:00:19 00:00:4
Hi all,
I have the following problem: I have a csv-file consisting of timestamp
values (no dates), e.g.:
Timestamp1;Timestamp2;
05:24:43;05:25:05;
15:47:02;15:47:22;
18:36:05;18:36:24;
15:21:24;15:22:04;
I need a vector with the difference of the two timestamps, so I read the
data with the read.
5 matches
Mail list logo