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

Replace direct access of tzone attribute #37

Closed
joshuaulrich opened this issue May 4, 2019 · 1 comment · Fixed by #38
Closed

Replace direct access of tzone attribute #37

joshuaulrich opened this issue May 4, 2019 · 1 comment · Fixed by #38

Comments

@joshuaulrich
Copy link
Contributor

There are a handful of places where you directly access the "tzone" attribute from the xts object. This attribute is being removed from the xts object, in favor of using the "tzone" attribute on the xts index attribute. That means calls to attr(x, "tzone") will return NULL, which will likely cause errors.

I see you currently depend on xts >= 0.8-8. That version created xts objects that had a "tzone" attribute on the index, as well as on the xts object itself. That means you should be able to replace all your calls to attr(x, "tzone") with attr(.index(x), "tzone"). That still accesses the attribute directly, instead of using the tzone() accessor function. But xts::tzone() doesn't exist until after version 0.11-2...

So, a better and more robust solution would involve defining a new function in spacetime that would mimic xts::tzone() if xts <= 0.11-2 is installed, and use xts::tzone() for xts versions > 0.11-2. I could write this function and submit a PR, if you would like to go this route.

@edzer
Copy link
Owner

edzer commented May 4, 2019

That would be great, Joshua!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants