'Trying to use wavelets on daily data
I am using daily time series data of 492 observation and three variables, (date, d, r). I get this message when I run this code.
library (biwavelet)
library(readxl)
library (ggplot2)
data <- read_excel("C:\Users\Ahmed c zone\Desktop\12.xlsx")
t1 <- cbind(1:492, data$d)
t2 <- cbind(1:492, data$r)
nrand=10
sum (is.na(t1))
sum (is.na(t2))
t2[is.na(t2)]<-0
wtc.AB = wtc(t1,t2, nrands = nrand)
par(oma=c(0,0,0,1), mar=c(5,4,5,5) + 0.1) plot(wtc.AB, plot.phas=TRUE, xaxt='n', lty.coi=1, col.coi="black", lwd.coi=2, lwd.sig=2,arrow.lwd=0.05, arrow.len=0.08, ylab="Scale", xlab="Years", plot.cb=T,main="Wavelet Coherence:X vs Y")
n=length(t1 [,1])
axis(side=1, at=c(seq(0, n, 123)), labels=c(seq(2020,2022, 5)))
rm(list=ls(all=TRUE))`
I got this error when i run the code from the second last line:
Error in axis(side = 1, at = c(seq(0, n, 260)), labels = c(seq(2020, 2022, : 'at' and 'labels' lengths differ, 2 != 1
Pic of code and error enter image description here
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|