[R] Error in if (x[j, g] == x[i, g]) { : missing value where TRUE/FALSE needed
Chattopadhyay, Somsubhra
sch298 at g.uky.edu
Thu Mar 17 16:22:48 CET 2016
I am using the "hydroTSM" package and "trend" package to convert my daily
time series into monthly and then analyze the seasonal trend. My code is
y <-read.csv("P-GHCNDUSW00093820.csv",as.is=TRUE)
y$DATE <- as.Date(as.character(y$DATE),format="%Y%m%d")
x <- xts(y$PRCP,y$DATE)
p <- daily2monthly(x, FUN=sum, na.rm = T)
r <- as.ts(p)
SeasonalMannKendall(r)
The last line returns an error like
Error in if (x[j, g] == x[i, g]) { :
missing value where TRUE/FALSE needed
I suspect that the error is because of the format of the time series object
which may not be correct as in the attached image. It is making the monthly
sums correct however I don't know why there are so many NA values. Each
year should have only 12 values for the 12 months.
Any ideas how to fix this error?
--
*Somsubhra Chattopadhyay*
Graduate Research Assistant
Biosystems and Agricultural Engineering Department
University of Kentucky, Lexington, KY 40546
Email: schattop14 at uky.edu
Cell: 9198026951
More information about the R-help
mailing list