Closed AndreMikulec closed 5 years ago
@edzer: maybe STI()
and STIDF()
should use inherits(time, "xts")
rather than is(time, "xts")
. The latter expression is where these messages come from if quantmod is loaded in the same session, since that package also does setOldClass("xts")
such that two formal "xts" classes are around. inherits()
can be used for S4 classes and it does not print that message. Using the lengthy is(time, getClassDef("xts", package="spacetime"))
would also avoid that message.
Reproducible example:
loadNamespace("quantmod")
#> <environment: namespace:quantmod>
loadNamespace("spacetime")
#> <environment: namespace:spacetime>
inherits(1, "xts")
#> [1] FALSE
is(1, "xts")
#> Found more than one class "xts" in cache; using the first, from namespace 'quantmod'
#> Also defined by 'spacetime'
#> [1] FALSE
Thanks, excellent suggestion!
The problem is not solved. I have recreated the problem with " a66e8a7" (so, " a66e8a7" did not solve the problem.)
I created a try-to-be minimalist example (package) here: https://github.com/AndreMikulec/NeverUsesSpacetime
The work in the package is not exactly my problem. In the example I call "spacetime:eof". https://github.com/AndreMikulec/NeverUsesSpacetime/blob/master/R/NeverUsesSpacetime.R
However, in my work, something, somewhere else (not my work), calls a spacetime::function (e.g. spacetime::eof).
The REAME.md has details on how to recreate the problem. https://github.com/AndreMikulec/NeverUsesSpacetime
The README.md output shows
Found more than one class "xts" in cache; using the first, from namespace 'quantmod'
Also defined by 'spacetime'
Found more than one class "xts" in cache; using the first, from namespace 'quantmod'
Also defined by 'spacetime'
Formal class 'classRepresentation' [package "methods"] with 11 slots
Note: I must keep in DESCRIPTION (see the README.md)
Depends:
xts
Imports:
DMwR
Also, the proper way to call a DMwR function (obviously) is
#' @importFrom DMwR LinearScaling
. . . DMwR:::LinearScaling
But I left those code lines commented out
. Those lines are not required to repeat the example.
Thanks, Andre
That's interesting. I currently cannot test, but the basic reason for these messages seems to be that both spacetime and quantmod do setOldClass("xts")
. So if both are loaded (by whatever means) two S4 representations of "xts" are in the cache, which is reported whenever the S4 representation of xts is queried. You might get fewer message replications than before the above commit, because at least some spacetime functions have reduced such querying. I'm not sure how any of these two independent packages could solve this overlap.
Every time, I run my programs, I am getting 20 of the same message. How to I stop these? I do not use, nor require, nor import, anything from spacetime.
I also tried following:
https://stackoverflow.com/questions/44295792/setoldclassxts-causing-problems-in-a-custom-r-package None of that works.
These messages are driving me nuts.
Thanks.