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

S3 method conflict with zoo #287

Closed
joshuaulrich opened this issue Feb 6, 2019 · 4 comments
Closed

S3 method conflict with zoo #287

joshuaulrich opened this issue Feb 6, 2019 · 4 comments
Assignees
Labels
Milestone

Comments

@joshuaulrich
Copy link
Owner

Kurt Hornik noticed, and Achim Zeileis reported that zoo's method for as.zoo.xts is overwritten by xts. So zoo's S3 registry entries are overwritten when xts is loaded.

It looks like the xts method only exists because it didn't exist in zoo at the time. I think the package that owns the class should define the conversion
method, so the as.zoo* methods should be in zoo.

Achim noted the difference in as.zoo.xts() between zoo and xts is small (with xts being better). He thinks we should just move xts' version into zoo, and I agree.

@joshuaulrich joshuaulrich self-assigned this Feb 6, 2019
@joshuaulrich
Copy link
Owner Author

I tried to address this and got a couple test failures when I removed xts' method without updating zoo's. The code below illustrates the difference:

R> x <- xts::.xts(, 1)
R> xts:::as.zoo.xts(x)
Data:
numeric(0)

Index:
[1] "1969-12-31 18:00:01 CST"
R> zoo:::as.zoo.xts(x)
1969-12-31 18:00:01
                 NA

So it seems like we would need a zoo release prior to removing it from xts and updating the zoo dependency version. Or maybe there's a way to only register it in xts if zoo is less than a specific version.

Achim suggested try using an .onLoad() hook similar to that in zoo/R/zzz.R which conditionally registers ggplot2 methods.

@joshuaulrich joshuaulrich added this to the 0.12-0 milestone Jul 4, 2019
@linusjf
Copy link

linusjf commented Jan 16, 2020

So has this been fixed? I'm getting the same message on R for Termux, version 3.6.2.

@joshuaulrich
Copy link
Owner Author

Yes, this is fixed. I'm working with CRAN to get the patched version released.

@linusjf
Copy link

linusjf commented Jan 17, 2020

Ok, thanks. I've suppressed the messages using suppressMessages.

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

2 participants