Re: [R] Some help with dates.

From: jim holtman <jholtman_at_gmail.com>
Date: Fri, 20 Jun 2008 05:35:22 -0400

Check out 'POSIXlt'. This should provide a hint as to how you can do it:

> ?as.POSIXlt
> x <- as.POSIXlt('2008-03-04 11:00')
> x

[1] "2008-03-04 11:00:00 GMT"
> unlist(x)

  sec min hour mday mon year wday yday isdst     0 0 11 4 2 108 2 63 0
> ?POSIXlt
> myDate <- paste(x$wday, x$hour)
> myDate

[1] "2 11"
>

On Fri, Jun 20, 2008 at 4:35 AM, Paul Fisch <fischp_at_gmail.com> wrote:
> Hey,
>
> I'm new to R but familiar with other programming languages.
>
> Basically, I want to store an array of dates. For each of these dates I
> want to store only the day of the week and the hour. So for example:
> "Monday 12" would be Monday at 12 o'clock and "Tuesday 20" would be Tuesday
> at 8 p.m.
>
> Alternatively it could be stored as 0-6 for Sunday to Saturday. So Tuesday
> at 11 a.m. would be something like "2 11".
>
> These dates don't need to be stored exactly like I have written. I just
> would like to know how R would store a day of the week combined with an hour
> in a variable.
>
>
> Thanks,
> Paul
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_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.
>

-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

______________________________________________
R-help_at_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.
Received on Fri 20 Jun 2008 - 09:39:25 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 20 Jun 2008 - 10:30:45 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive