Skip to content

dates and time series management

1 message · arun

#
Hi,
I think it is due to the missing values:
I get warnings()
?z.5.annualMax<- daily2annual(z, FUN=max, na.rm=TRUE,dates=1)
#There were 50 or more warnings (use warnings() to see the first 50)
write.csv(z.5max.annual, file = "Stations.csv")
Just to validate? the result:


I tried this:
res3<- lapply(seq_len(ncol(res1[,-1])),function(i) {x<-data.frame(res1[,1],res1[,i+1]); names(x)<- c(names(res1)[1],names(res1)[i+1]);x})
res4<-lapply(res3,function(x) {x1<-x[!is.na(x$dates),]; na.omit(x1)})
library(zoo)
zl<- lapply(res4,function(x) zoo(x[,-1],order.by=x[,1]))
zl.max.annual<- lapply(zl,function(x) daily2annual(x,FUN=max,na.rm=TRUE)) #no warnings()
#na.rm=TRUE inside the daily2annual() didn't show any effect.

?sapply(zl.max.annual,length)
#? [1] 45 42 44 45 37 45 44 44 41 45 25 45 45 45 45 45 45 45 45 45 45 41 40 41 45
?#[26] 44 45 45 45 45 44 42 45 38 45 45 45 38 44 31 45 45 45 42 45 36 42 45 42 45
?#[51] 45 45 44 45 40 41 45 45 45 45 34 45 34 45 45 41 41 45 45 45 45 45 45 45 45
?#[76] 45 43 40 29 44 29 42 45 40 44 33 45 45 43 40 45 45 45 45 43 45 34 45 44 45
#[101] 45 44 30 44 44 42 45 45 43 42 44 45 45 45 45 42 45 39 39
library(xts)
zl.max.annual1<-lapply(zl.max.annual, as.xts)
?zl.merge<- Reduce(function(...) merge(...),zl.max.annual1))
?zl.merge[1:3,1:8]
#???????????? ..1?? ..2? ..2.1 ..2.2 ..2.3 ..2.4? ..2.5 ..2.6
#1961-01-01 35.37??? NA? 13.43 40.88 17.69 38.44? 50.56 36.93
#1962-01-01 34.54 34.85 102.97 39.84 73.43 68.88? 63.88 22.89
#1963-01-01 18.32??? NA? 64.18 51.49 14.61 40.79 127.74 25.07
?z.5.annualMax[1:3,1:8]
?# ???????? dt3011120.txt dt3011240.txt dt3011887.txt dt3012205.txt
#1961-01-01???????? 35.37??????????? NA???????? 13.43???????? 40.88
#1962-01-01???????? 34.54???????? 34.85??????? 102.97???????? 39.84
#1963-01-01???????? 18.32??????????? NA???????? 64.18???????? 51.49
?# ???????? dt3012280.txt dt3015405.txt dt3015523.txt dt3015960.txt
#1961-01-01???????? 17.69???????? 38.44???????? 50.56???????? 36.93
#1962-01-01???????? 73.43???????? 68.88???????? 63.88???????? 22.89
#1963-01-01???????? 14.61???????? 40.79??????? 127.74???????? 25.07

Looks like this is the same result as above.
A.K.