'Problem generating wavelet variance/covarance

How do I solve the error?

Here's my script:

A=x B=y wf <- "la8" J <- 8 N<- length(A) A.modwt <- modwt(A, wf, J) B.modwt <- modwt(B, wf, J) A.modwt.bw <- brick.wall(A.modwt, wf) B.modwt.bw <- brick.wall(B.modwt, wf) WCOV = wave.covariance(A.modwt.bw, B.modwt.bw) Error in x[c((n%/%2):n, 1:(n%/%2 - 1))] : only 0's may be mixed with negative subscripts



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source