I am trying out weather forecasting on R.
This is my work so far:
chn<-read.csv("chennai.csv")
install.packages("xts")
install.packages("tsbox")
install.packages("forecast")
library(xts)
library(tsbox)
#prepare historical data
historical = xts(chn[,c("TMAX","TMIN","PRCP")], order.by=as.Date(chn$DATE))
historical = ts_regular(historical)
historical = na.fill(historical, "extend")
historical = window(historical, start=as.Date("2010-01-01"), end=as.Date("2022-05-16"))
monthly.tmax = period.apply(historical$TMAX, INDEX = seq(1, nrow(historical) - 1, 30.4375), FUN = mean)
plot(ts_ts(monthly.tmax), col="darkred", ylim=c(20, 100),
lwd=3, bty="n", las=1, fg=NA, ylab="TMAX (F)")
grid(nx=NA, ny=NULL, lty=1)
I get an error ouput: series has no regular pattern. I tried figuring out what it means to fix it. But I am stomped