Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set indexTZ=UTC for all index classes without a TZ component #66

Closed
joshuaulrich opened this issue Mar 22, 2015 · 0 comments
Closed

Set indexTZ=UTC for all index classes without a TZ component #66

joshuaulrich opened this issue Mar 22, 2015 · 0 comments
Assignees
Labels

Comments

@joshuaulrich
Copy link
Owner

The xts constructor currently only checks the timezone (and ensures it's set to "UTC") for Date class indexes. It should do this for all index classes that do not use a timezone. Eric Zivot reported a manifestation of this issue in a thread on R-SIG-Finance. Here's a minimal, reproducible example:

data(sample_matrix)
x <- as.xts(sample_matrix)
y <- to.monthly(x)
y['2007']
#            x.Open   x.High    x.Low  x.Close
# Feb 2007 50.22448 51.32342 50.19101 50.77091
# Mar 2007 50.81620 50.81620 48.23648 48.97490
# Apr 2007 48.94407 50.33781 48.80962 49.33974
# May 2007 49.34572 49.69097 47.51796 47.73780
# Jun 2007 47.74432 47.94127 47.09144 47.76719

According to check.TZ, the current list of classes should be: chron::chron, chron::dates, chron::times, and base::Date. But zoo::yearmon and zoo::yearqtr should also be included in this list.

@joshuaulrich joshuaulrich self-assigned this Mar 22, 2015
@joshuaulrich joshuaulrich modified the milestone: Release 0.9-8 Apr 11, 2015
joshuaulrich added a commit that referenced this issue May 20, 2015
Although it's not technically correct (since GMT *is* a timezone)
indexTZ="GMT" should work for all practical purposes. So check.TZ
should not warn in this case.

Also make the warning for indexTZ="" more explicit by printing empty
quotes instead of an empty string (i.e. from "...but indexTZ is " to
"...but indexTZ is ''").
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant