Closed ggrothendieck closed 2 years ago
Thanks for the report! I agree split.xts()
should be consistent with zoo and return a named list.
Do you expect the names to be 2009-07-01
and 2009-07-01
?
You can disable the TZ warnings globally with options(xts_check_TZ = FALSE)
. That said, I'll look into why the warning appears here and see if I can quiet it.
Perhaps split.xts could have a tz= argument to specify this.
On Wed, Oct 6, 2021 at 8:35 AM Joshua Ulrich @.***> wrote:
Thanks for the report! I agree split.xts() should be consistent with zoo and return a named list.
You can disable the TZ warnings globally with options(xts_check_TZ = FALSE). I'll look into why the warning appears here and see if I can quiet it.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/joshuaulrich/xts/issues/357#issuecomment-936152646, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB32F7V35AYHZJMPDZT36KTUFQ7B3ANCNFSM5FOMRRNA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
-- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com
What do you suggest for the names? The value of the first index value, formatted to the periodicity? E.g. "days" -> Date; "months" -> yearmon; "quarters" -> yearqtr; "years" -> "%Y"?
Seems goo
On Fri, Oct 8, 2021 at 9:01 AM Joshua Ulrich @.***> wrote:
What do you suggest for the names? The value of the first index value, formatted to the periodicity? E.g. "days" -> Date; "months" -> yearmon; "quarters" -> yearqtr; "years" -> "%Y"?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/joshuaulrich/xts/issues/357#issuecomment-938624327, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB32F7SHKJCIGLLGQIRJ7MTUF3TSLANCNFSM5FOMRRNA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
-- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com
I looked into this a bit. The warning is thrown by print.xts()
, because x
has a POSIXct index with tzone = UTC, and the system TZ is not UTC.
R$ head(x)
rrp_nsw rrp_qld rrp_sa rrp_tas rrp_vic
2009-07-01 23:15:00 -0.108511 -0.343630 -0.090571 -0.022001 -0.021752
2009-07-01 23:20:00 -0.446627 -0.333669 -0.626428 -0.474671 -0.449508
2009-07-01 23:25:00 0.240643 0.168739 0.353800 0.166670 0.164779
2009-07-01 23:30:00 1.679788 1.249041 2.565790 1.165852 1.750981
2009-07-01 23:35:00 -2.278705 -1.417320 -2.109532 -4.200741 -1.998850
2009-07-01 23:40:00 0.017496 0.010129 0.025341 0.020790 0.031040
Warning message:
timezone of object (UTC) is different than current timezone ().
split.xts()
determines when a day starts/ends based on the tzone
of the xts object. In your example, it splits on UTC-days because the tzone of the object is UTC.
You need to change the xts object's tzone if you want to split on days in a different timezone. For example: tzone(x) <- "America/Chicago"; split(x, "days")
.
I'll name the returned list, but I don't think split.xts()
should modify the xts object's timezone attribute.
split.xts
should give a named list rather than an unnamed list in the example below. Also it gives an annoying warning message and there is no way to turn it off or control the time zone with respect to which it is split short of usingsplit(x, as.Date(time(x)))
orsplit(x, as.Date(time(x), tz = whatever))
giving: