Reputation: 16
Why does window.xts not work in parLapply? The below code gives me error:
"Error in checkForRemoteErrors(val) : 8 nodes produced errors; first error: invalid time / time based class"
library(parallel)
z <- xts(11:15, as.Date(31:35))
testfun <- function(input,x){
window(input, start = 32, end = 34) + x
}
cl <- makeCluster(8)
clusterEvalQ(cl, {
library(xts)
})
clusterExport(cl, c("testfun"))
clusterExport(cl, c("z"))
r_1 <- parLapply(
cl = cl,
X = 1:8,
fun = testfun,
input = z)
stopCluster(cl)
Upvotes: 0
Views: 51
Reputation: 6805
You get the same error without parallelization;
> library(xts)
> z <- xts(11:15, as.Date(31:35))
> y <- window(z, start = 32, end = 34)
Error in .toPOSIXct(start, tzone(x)) : invalid time / time based class
Upvotes: 2