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.
|
|
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
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
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,
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,
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,
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)
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
8 matches
Mail list logo