[R] format() method
kafkaz
kafka at centras.lt
Fri Apr 16 15:28:45 CEST 2010
Hello,
I use format() function to get number of the week, like this:
format(tmp,'%U')
Recently, I have spotted something bizarre. For example, I have such object:
(index(tmp$x.delta['2009'][1:16]))
[1] "2009-01-02 CET" "2009-01-09 CET" "2009-01-16 CET" "2009-01-23 CET"
[5] "2009-01-30 CET" "2009-02-06 CET" "2009-02-13 CET" "2009-02-20 CET"
[9] "2009-02-27 CET" "2009-03-06 CET" "2009-03-13 CET" "2009-03-20 CET"
[13] "2009-03-27 CET" "2009-04-03 CEST" "2009-04-09 CEST" "2009-04-17 CEST"
dput(index(tmp$x.delta['2009'][1:16]),'%U',file='as.date')
structure(c(1230850800, 1231455600, 1232060400, 1232665200, 1233270000,
1233874800, 1234479600, 1235084400, 1235689200, 1236294000, 1236898800,
1237503600, 1238108400, 1238709600, 1239228000, 1239919200), tzone =
structure("", .Names = "TZ"), class = c("POSIXt",
"POSIXct"))
To get number of the week I run:
format(index(tmp$x.delta['2009'][1:16]),'%U')
Here is the output - the weird thing is, that the first number of the week
is 00.
[1] "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "13"
"14"
[16] "15"
Is it the bug, my mistake or it is supposed to by like that?
Thank you,
kafka
--
View this message in context: http://n4.nabble.com/format-method-tp1999753p1999753.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list