Closed AndreMikulec closed 5 years ago
Wild guessing and comparing/constrasting to binsearch that appears in the same file:
binsearch.c
https://github.com/joshuaulrich/xts/blob/e3120c634ba6d1148385922d6a6cdfeab3bfe630/src/binsearch.c
Comparing https://github.com/joshuaulrich/xts/search?q=binsearch&unscoped_q=binsearch to https://github.com/joshuaulrich/xts/search?q=fill_window_dups_rev&unscoped_q=fill_window_dups_rev then maybe maybe the call should be like?
xts:::fill_window_dups_rev
No That is not it.
xts:::fill_window_dups_rev
Works fine when I load xts into RStudio as a package
> devtools::load_all(".")
Loading xts
> xts:::window_idx(x = xts(NA, zoo::as.Date("1948-11-30")), index. = as.POSIXct("1948-11-30"))
[1] 1
However, from an installed package, it does not.
> devtools::install(".", args = "--preclean --no-multiarch --with-keep.source")
Installing xts
* DONE (xts)
In R CMD INSTALL
Reloading installed xts
> library(xts)
> xts:::window_idx(x = xts(NA, zoo::as.Date("1948-11-30")), index. = as.POSIXct("1948-11-30"))
Error in .Call("fill_window_dups_rev", tmp, .index(x), PACKAGE = "xts") :
"fill_window_dups_rev" not available for .Call() for package "xts"
Change
# res <- .Call("fill_window_dups_rev", tmp, .index(x), PACKAGE = "xts")
res <- xts:::fill_window_dups_rev(tmp, .index(x))
> devtools::load_all(".")
> xts:::window_idx(x = xts(NA, zoo::as.Date("1948-11-30")), index. = as.POSIXct("1948-11-30"))
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) :
object 'fill_window_dups_rev' not found
Called from:
This looks a lot like you had an older version of xts installed and upgraded to a newer version while the old version was loaded in an active R session. You need to either: 1) re-install after closing all active R sessions, or 2) install the newest xts to a new library and load it from there.
I'm closing this issue, since it's unlikely a problem in xts itself. I'm still happy to try to help if you are still having problems after trying the two things I mentioned.
Thanks,
I ended up working (badly) around the problem by doing . . .
unloadNamespace("quantmod");unloadNamespace("PerformanceAnalytics");unloadNamespace("TTR");unloadNamespace("xts");devtools::load_all("./xts")
debug(library)
library(quantmod)
# at the right spot
# just before .getRequiredPackages2(pkgInfo, quietly = quietly)
# do: pkgInfo$Depends$xts <- NULL
library(PerformanceAnalytics)
# at the right spot
# just before .getRequiredPackages2(pkgInfo, quietly = quietly)
# do: pkgInfo$Depends$xts <- NULL
undebug(library)
# program with require(quantmod), require(PerformanceAnalytics)
rm(list=setdiff(ls(all.names=TRUE),c("con","cid"))); debugSource('W:/R-3.5._/programWithRequires.R');
But, then, I installed brand new R. https://cran.r-project.org/bin/windows/base/rpatched.html This is a combined Windows 32/64 bit binary build R including patches up to 2018-10-10 (r75424).
I installed a brand new quantmod and dependents(xts). Then, I tried and it works correctly:
> Sys.setenv(TZ="UTC")
> library(xts)
Loading required package: zoo
Attaching package: ‘zoo’
The following objects are masked from ‘package:base’:
as.Date, as.Date.numeric
> xts:::window_idx(x = xts(NA, zoo::as.Date("1948-11-30")), index. = as.POSIXct("1948-11-30"))
[1] 1
So, currently (in my other R), something is interfering with something somewhere. Currently, I am working backwards trying to figure it out.
Thanks.
Description
Expected behavior
'not an error'
Minimal, reproducible example and Session Info
So exactly
I tried both CRAN xts and github lastest (master) xts. The error is the same.
Tried Patched R. https://cran.r-project.org/bin/windows/base/rpatched.html This is a combined Windows 32/64 bit binary build R including patches up to 2018-10-10 (r75424).
New R patched results (are the same).
Note: if this error can not be reproduced, then please write back to this issue.