Re: [R] handling the output of strsplit

2008-06-23 Thread Patrick Connolly
On Sat, 21-Jun-2008 at 05:33AM -0700, Mark Difford wrote: | | Hi Denis, | | h = c(3h30, 6h30, 9h40, 11h25, 14h00, | 15h55, 23h) | | I could not figure out how to use chron to import this into times, so | I tried to extract the hours and minutes on my own. | |

Re: [R] handling the output of strsplit

2008-06-23 Thread jim holtman
One way, if you are unsure of your data, is to append two additional zeros on to the strings: strptime(23h, format=%Hh%M) [1] NA strptime(paste(23h, 00, sep=), format=%Hh%M) [1] 2008-06-23 23:00:00 GMT strptime(paste(23h04, 00, sep=), format=%Hh%M) [1] 2008-06-23 23:04:00 GMT On Mon, Jun

Re: [R] handling the output of strsplit

2008-06-21 Thread Mark Difford
Hi Denis, h = c(3h30, 6h30, 9h40, 11h25, 14h00, 15h55, 23h) I could not figure out how to use chron to import this into times, so I tried to extract the hours and minutes on my own. Look at ?strptime for this: ## strptime(6h30, format=%Ih%M) [1] 2008-06-21

[R] handling the output of strsplit

2008-06-20 Thread Denis Chabot
Hi, Simple question, but I did not figure out how to find the answer on my own (wrong choice of keywords on my part). I have a character variable for time of day that has entries looking like 6h30, 7h40, 12h25, 23h, etc. For the sake of this message, say h = c(3h30, 6h30,

Re: [R] handling the output of strsplit

2008-06-20 Thread Wacek Kusnierczyk
Denis Chabot wrote: Hi, Simple question, but I did not figure out how to find the answer on my own (wrong choice of keywords on my part). I have a character variable for time of day that has entries looking like 6h30, 7h40, 12h25, 23h, etc. For the sake of this message, say h = c(3h30,

Re: [R] handling the output of strsplit

2008-06-20 Thread Wacek Kusnierczyk
Denis Chabot wrote: Hi, Simple question, but I did not figure out how to find the answer on my own (wrong choice of keywords on my part). I have a character variable for time of day that has entries looking like 6h30, 7h40, 12h25, 23h, etc. For the sake of this message, say h = c(3h30,

Re: [R] handling the output of strsplit

2008-06-20 Thread Gabor Grothendieck
We construct a times object by replacing the letter h with a : and then pasting a :00 on the end. Then replace any occurrence of :: with :00: . Its now in the format that times recognizes so we can just convert that to times and apply hours() and minutes() to get the components: library(chron)

Re: [R] handling the output of strsplit

2008-06-20 Thread Denis Chabot
Most helpful Gabor, Many thanks, Denis Le 08-06-20 à 18:58, Gabor Grothendieck a écrit : We construct a times object by replacing the letter h with a : and then pasting a :00 on the end. Then replace any occurrence of :: with :00: . Its now in the format that times recognizes so we can