[R] converting character vector hh:mm to chron or strptime 24 clock time vectors

2010-02-16 Thread Alex Anderson
Hi All, I am attempting to work with some data from loggers. I have read in a .csv exported from MS Access that already has my dates and times (in 24 clock format), (with StringsAsFactors=FALSE). head(tdata) LogData date time 177.16 2008/04/24 02:00 2

Re: [R] converting character vector hh:mm to chron or strptime 24 clock time vectors

2010-02-16 Thread stephen sefick
library(chron) #untested as.chron(paste(tdata[,date], tdata[,time]), %Y/%m/%d %H:%M) On Tue, Feb 16, 2010 at 4:47 AM, Alex Anderson complicad...@yahoo.com.au wrote: Hi All, I am attempting to work with some data from loggers. I have read in a .csv exported from MS Access that already has my

Re: [R] converting character vector hh:mm to chron or strptime 24 clock time vectors

2010-02-16 Thread Jim Lemon
On 02/16/2010 09:47 PM, Alex Anderson wrote: ... This is the problem 6 96.88 2008/04/24 24:00 Error in `$-.data.frame`(`*tmp*`, time2, value = list(sec = c(0, 0, : replacement has 9 rows, data has 10 Hi Alex, You have a problem with an invalid time. The line should read: 6 96.88 2008/05/24

Re: [R] converting character vector hh:mm to chron or strptime 24 clock time vectors

2010-02-16 Thread Sharpie
Jim Lemon wrote: On 02/16/2010 09:47 PM, Alex Anderson wrote: ... This is the problem 6 96.88 2008/04/24 24:00 Error in `$-.data.frame`(`*tmp*`, time2, value = list(sec = c(0, 0, : replacement has 9 rows, data has 10 Hi Alex, You have a problem with an invalid time. The line should

Re: [R] converting character vector hh:mm to chron or strptime 24 clock time vectors

2010-02-16 Thread Jim Lemon
... If it gets too confusing, just coerce your POSIXlt objects to POSIXct objects which don't have issues with odd lengths. Thanks to Mark and Charlie, your messages have enlightened me and hopefully provided a solution for Alex, who was the one with the problem.

Re: [R] converting character vector hh:mm to chron or strptime 24 clock time vectors

2010-02-16 Thread Gabor Grothendieck
Try this (and note that times must be less than 24 hours): Lines - LogData date time + 177.16 2008/04/24 02:00 + 261.78 2008/04/24 04:00 + 375.44 2008/04/24 06:00 + 489.43 2008/04/24 08:00 + 595.83 2008/04/24 10:00 +