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 <iey...@sugimoto.at> wrote: > > 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.csv-function: > myObj <- read.csv("file.csv",header=TRUE,sep=";"). > > I have then tried unsuccessfully to convert the data to time format (e.g. > using the strptime function like date1 <- > strptime(myObj[0],format="%H:%M:%S")) to be able to perform a datediff > operation. > > I would be very grateful if anybody could give me some assistance. > > Thanks in advance, > Ieyasu > -- > View this message in context: > http://www.nabble.com/diff-of-two-timestamps-tp25267603p25267603.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
______________________________________________ R-help@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.