[R] Some help with dates.
jholtman at gmail.com
Fri Jun 20 11:35:22 CEST 2008
Check out 'POSIXlt'. This should provide a hint as to how you can do it:
> x <- as.POSIXlt('2008-03-04 11:00')
 "2008-03-04 11:00:00 GMT"
sec min hour mday mon year wday yday isdst
0 0 11 4 2 108 2 63 0
> myDate <- paste(x$wday, x$hour)
 "2 11"
On Fri, Jun 20, 2008 at 4:35 AM, Paul Fisch <fischp at gmail.com> wrote:
> 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.
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
+1 513 646 9390
What is the problem you are trying to solve?
More information about the R-help