使用 xts 将包含 0 和 NA 的每日时间序列转换为每月
daily time series containing both 0 and NA to monthly conversion using xts
我每天都有包含 0 和 NA 值的时间序列数据。我想使用 R 中的 xts
包将其转换为每月数据。我使用以下代码
xx=as.Date(dat$Date)
yy=dat$Value
Rain <- xts(yy, order.by = xx)
apply.monthly(Rain, FUN=sum, na.rm=TRUE)
它为 NA 值返回零。由于数据也包含零,因此很难区分零值和 NA 值。当我使用 na.pass=T
like
apply.monthly(Rain, FUN=sum, na.pass=TRUE)
它给了我 NA,但零被 1 代替了。
我希望每个月的值都包含NA,原时间序列有NA,时间序列有0,应该保持0。如何实现?
这是数据
dat <-structure(list(Date = structure(1:1310, .Label = c("1991-06-01",
"1991-06-02", "1991-06-03", "1991-06-04", "1991-06-05", "1991-06-06",
"1991-06-07", "1991-06-08", "1991-06-09", "1991-06-10", "1991-06-11",
"1991-06-12", "1991-06-13", "1991-06-14", "1991-06-15", "1991-06-16",
"1991-06-17", "1991-06-18", "1991-06-19", "1991-06-20", "1991-06-21",
"1991-06-22", "1991-06-23", "1991-06-24", "1991-06-25", "1991-06-26",
"1991-06-27", "1991-06-28", "1991-06-29", "1991-06-30", "1991-07-01",
"1991-07-02", "1991-07-03", "1991-07-04", "1991-07-05", "1991-07-06",
"1991-07-07", "1991-07-08", "1991-07-09", "1991-07-10", "1991-07-11",
"1991-07-12", "1991-07-13", "1991-07-14", "1991-07-15", "1991-07-16",
"1991-07-17", "1991-07-18", "1991-07-19", "1991-07-20", "1991-07-21",
"1991-07-22", "1991-07-23", "1991-07-24", "1991-07-25", "1991-07-26",
"1991-07-27", "1991-07-28", "1991-07-29", "1991-07-30", "1991-07-31",
"1991-08-01", "1991-08-02", "1991-08-03", "1991-08-04", "1991-08-05",
"1991-08-06", "1991-08-07", "1991-08-08", "1991-08-09", "1991-08-10",
"1991-08-11", "1991-08-12", "1991-08-13", "1991-08-14", "1991-08-15",
"1991-08-16", "1991-08-17", "1991-08-18", "1991-08-19", "1991-08-20",
"1991-08-21", "1991-08-22", "1991-08-23", "1991-08-24", "1991-08-25",
"1991-08-26", "1991-08-27", "1991-08-28", "1991-08-29", "1991-08-30",
"1991-08-31", "1991-09-01", "1991-09-02", "1991-09-03", "1991-09-04",
"1991-09-05", "1991-09-06", "1991-09-07", "1991-09-08", "1991-09-09",
"1991-09-10", "1991-09-11", "1991-09-12", "1991-09-13", "1991-09-14",
"1991-09-15", "1991-09-16", "1991-09-17", "1991-09-18", "1991-09-19",
"1991-09-20", "1991-09-21", "1991-09-22", "1991-09-23", "1991-09-24",
"1991-09-25", "1991-09-26", "1991-09-27", "1991-09-28", "1991-09-29",
"1991-09-30", "1991-10-01", "1991-10-02", "1991-10-03", "1991-10-04",
"1991-10-05", "1991-10-06", "1991-10-07", "1991-10-08", "1991-10-09",
"1991-10-10", "1991-10-11", "1991-10-12", "1991-10-13", "1991-10-14",
"1991-10-15", "1991-10-16", "1991-10-17", "1991-10-18", "1991-10-19",
"1991-10-20", "1991-10-21", "1991-10-22", "1991-10-23", "1991-10-24",
"1991-10-25", "1991-10-26", "1991-10-27", "1991-10-28", "1991-10-29",
"1991-10-30", "1991-10-31", "1991-11-01", "1991-11-02", "1991-11-03",
"1991-11-04", "1991-11-05", "1991-11-06", "1991-11-07", "1991-11-08",
"1991-11-09", "1991-11-10", "1991-11-11", "1991-11-12", "1991-11-13",
"1991-11-14", "1991-11-15", "1991-11-16", "1991-11-17", "1991-11-18",
"1991-11-19", "1991-11-20", "1991-11-21", "1991-11-22", "1991-11-23",
"1991-11-24", "1991-11-25", "1991-11-26", "1991-11-27", "1991-11-28",
"1991-11-29", "1991-11-30", "1991-12-01", "1991-12-02", "1991-12-03",
"1991-12-04", "1991-12-05", "1991-12-06", "1991-12-07", "1991-12-08",
"1991-12-09", "1991-12-10", "1991-12-11", "1991-12-12", "1991-12-13",
"1991-12-14", "1991-12-15", "1991-12-16", "1991-12-17", "1991-12-18",
"1991-12-19", "1991-12-20", "1991-12-21", "1991-12-22", "1991-12-23",
"1991-12-24", "1991-12-25", "1991-12-26", "1991-12-27", "1991-12-28",
"1991-12-29", "1991-12-30", "1991-12-31", "1992-01-01", "1992-01-02",
"1992-01-03", "1992-01-04", "1992-01-05", "1992-01-06", "1992-01-07",
"1992-01-08", "1992-01-09", "1992-01-10", "1992-01-11", "1992-01-12",
"1992-01-13", "1992-01-14", "1992-01-15", "1992-01-16", "1992-01-17",
"1992-01-18", "1992-01-19", "1992-01-20", "1992-01-21", "1992-01-22",
"1992-01-23", "1992-01-24", "1992-01-25", "1992-01-26", "1992-01-27",
"1992-01-28", "1992-01-29", "1992-01-30", "1992-01-31", "1992-02-01",
"1992-02-02", "1992-02-03", "1992-02-04", "1992-02-05", "1992-02-06",
"1992-02-07", "1992-02-08", "1992-02-09", "1992-02-10", "1992-02-11",
"1992-02-12", "1992-02-13", "1992-02-14", "1992-02-15", "1992-02-16",
"1992-02-17", "1992-02-18", "1992-02-19", "1992-02-20", "1992-02-21",
"1992-02-22", "1992-02-23", "1992-02-24", "1992-02-25", "1992-02-26",
"1992-02-27", "1992-02-28", "1992-02-29", "1992-03-01", "1992-03-02",
"1992-03-03", "1992-03-04", "1992-03-05", "1992-03-06", "1992-03-07",
"1992-03-08", "1992-03-09", "1992-03-10", "1992-03-11", "1992-03-12",
"1992-03-13", "1992-03-14", "1992-03-15", "1992-03-16", "1992-03-17",
"1992-03-18", "1992-03-19", "1992-03-20", "1992-03-21", "1992-03-22",
"1992-03-23", "1992-03-24", "1992-03-25", "1992-03-26", "1992-03-27",
"1992-03-28", "1992-03-29", "1992-03-30", "1992-03-31", "1992-04-01",
"1992-04-02", "1992-04-03", "1992-04-04", "1992-04-05", "1992-04-06",
"1992-04-07", "1992-04-08", "1992-04-09", "1992-04-10", "1992-04-11",
"1992-04-12", "1992-04-13", "1992-04-14", "1992-04-15", "1992-04-16",
"1992-04-17", "1992-04-18", "1992-04-19", "1992-04-20", "1992-04-21",
"1992-04-22", "1992-04-23", "1992-04-24", "1992-04-25", "1992-04-26",
"1992-04-27", "1992-04-28", "1992-04-29", "1992-04-30", "1992-05-01",
"1992-05-02", "1992-05-03", "1992-05-04", "1992-05-05", "1992-05-06",
"1992-05-07", "1992-05-08", "1992-05-09", "1992-05-10", "1992-05-11",
"1992-05-12", "1992-05-13", "1992-05-14", "1992-05-15", "1992-05-16",
"1992-05-17", "1992-05-18", "1992-05-19", "1992-05-20", "1992-05-21",
"1992-05-22", "1992-05-23", "1992-05-24", "1992-05-25", "1992-05-26",
"1992-05-27", "1992-05-28", "1992-05-29", "1992-05-30", "1992-05-31",
"1992-06-01", "1992-06-02", "1992-06-03", "1992-06-04", "1992-06-05",
"1992-06-06", "1992-06-07", "1992-06-08", "1992-06-09", "1992-06-10",
"1992-06-11", "1992-06-12", "1992-06-13", "1992-06-14", "1992-06-15",
"1992-06-16", "1992-06-17", "1992-06-18", "1992-06-19", "1992-06-20",
"1992-06-21", "1992-06-22", "1992-06-23", "1992-06-24", "1992-06-25",
"1992-06-26", "1992-06-27", "1992-06-28", "1992-06-29", "1992-06-30",
"1992-07-01", "1992-07-02", "1992-07-03", "1992-07-04", "1992-07-05",
"1992-07-06", "1992-07-07", "1992-07-08", "1992-07-09", "1992-07-10",
"1992-07-11", "1992-07-12", "1992-07-13", "1992-07-14", "1992-07-15",
"1992-07-16", "1992-07-17", "1992-07-18", "1992-07-19", "1992-07-20",
"1992-07-21", "1992-07-22", "1992-07-23", "1992-07-24", "1992-07-25",
"1992-07-26", "1992-07-27", "1992-07-28", "1992-07-29", "1992-07-30",
"1992-07-31", "1992-08-01", "1992-08-02", "1992-08-03", "1992-08-04",
"1992-08-05", "1992-08-06", "1992-08-07", "1992-08-08", "1992-08-09",
"1992-08-10", "1992-08-11", "1992-08-12", "1992-08-13", "1992-08-14",
"1992-08-15", "1992-08-16", "1992-08-17", "1992-08-18", "1992-08-19",
"1992-08-20", "1992-08-21", "1992-08-22", "1992-08-23", "1992-08-24",
"1992-08-25", "1992-08-26", "1992-08-27", "1992-08-28", "1992-08-29",
"1992-08-30", "1992-08-31", "1992-09-01", "1992-09-02", "1992-09-03",
"1992-09-04", "1992-09-05", "1992-09-06", "1992-09-07", "1992-09-08",
"1992-09-09", "1992-09-10", "1992-09-11", "1992-09-12", "1992-09-13",
"1992-09-14", "1992-09-15", "1992-09-16", "1992-09-17", "1992-09-18",
"1992-09-19", "1992-09-20", "1992-09-21", "1992-09-22", "1992-09-23",
"1992-09-24", "1992-09-25", "1992-09-26", "1992-09-27", "1992-09-28",
"1992-09-29", "1992-09-30", "1992-10-01", "1992-10-02", "1992-10-03",
"1992-10-04", "1992-10-05", "1992-10-06", "1992-10-07", "1992-10-08",
"1992-10-09", "1992-10-10", "1992-10-11", "1992-10-12", "1992-10-13",
"1992-10-14", "1992-10-15", "1992-10-16", "1992-10-17", "1992-10-18",
"1992-10-19", "1992-10-20", "1992-10-21", "1992-10-22", "1992-10-23",
"1992-10-24", "1992-10-25", "1992-10-26", "1992-10-27", "1992-10-28",
"1992-10-29", "1992-10-30", "1992-10-31", "1992-11-01", "1992-11-02",
"1992-11-03", "1992-11-04", "1992-11-05", "1992-11-06", "1992-11-07",
"1992-11-08", "1992-11-09", "1992-11-10", "1992-11-11", "1992-11-12",
"1992-11-13", "1992-11-14", "1992-11-15", "1992-11-16", "1992-11-17",
"1992-11-18", "1992-11-19", "1992-11-20", "1992-11-21", "1992-11-22",
"1992-11-23", "1992-11-24", "1992-11-25", "1992-11-26", "1992-11-27",
"1992-11-28", "1992-11-29", "1992-11-30", "1992-12-01", "1992-12-02",
"1992-12-03", "1992-12-04", "1992-12-05", "1992-12-06", "1992-12-07",
"1992-12-08", "1992-12-09", "1992-12-10", "1992-12-11", "1992-12-12",
"1992-12-13", "1992-12-14", "1992-12-15", "1992-12-16", "1992-12-17",
"1992-12-18", "1992-12-19", "1992-12-20", "1992-12-21", "1992-12-22",
"1992-12-23", "1992-12-24", "1992-12-25", "1992-12-26", "1992-12-27",
"1992-12-28", "1992-12-29", "1992-12-30", "1992-12-31", "1993-01-01",
"1993-01-02", "1993-01-03", "1993-01-04", "1993-01-05", "1993-01-06",
"1993-01-07", "1993-01-08", "1993-01-09", "1993-01-10", "1993-01-11",
"1993-01-12", "1993-01-13", "1993-01-14", "1993-01-15", "1993-01-16",
"1993-01-17", "1993-01-18", "1993-01-19", "1993-01-20", "1993-01-21",
"1993-01-22", "1993-01-23", "1993-01-24", "1993-01-25", "1993-01-26",
"1993-01-27", "1993-01-28", "1993-01-29", "1993-01-30", "1993-01-31",
"1993-02-01", "1993-02-02", "1993-02-03", "1993-02-04", "1993-02-05",
"1993-02-06", "1993-02-07", "1993-02-08", "1993-02-09", "1993-02-10",
"1993-02-11", "1993-02-12", "1993-02-13", "1993-02-14", "1993-02-15",
"1993-02-16", "1993-02-17", "1993-02-18", "1993-02-19", "1993-02-20",
"1993-02-21", "1993-02-22", "1993-02-23", "1993-02-24", "1993-02-25",
"1993-02-26", "1993-02-27", "1993-02-28", "1993-03-01", "1993-03-02",
"1993-03-03", "1993-03-04", "1993-03-05", "1993-03-06", "1993-03-07",
"1993-03-08", "1993-03-09", "1993-03-10", "1993-03-11", "1993-03-12",
"1993-03-13", "1993-03-14", "1993-03-15", "1993-03-16", "1993-03-17",
"1993-03-18", "1993-03-19", "1993-03-20", "1993-03-21", "1993-03-22",
"1993-03-23", "1993-03-24", "1993-03-25", "1993-03-26", "1993-03-27",
"1993-03-28", "1993-03-29", "1993-03-30", "1993-03-31", "1993-04-01",
"1993-04-02", "1993-04-03", "1993-04-04", "1993-04-05", "1993-04-06",
"1993-04-07", "1993-04-08", "1993-04-09", "1993-04-10", "1993-04-11",
"1993-04-12", "1993-04-13", "1993-04-14", "1993-04-15", "1993-04-16",
"1993-04-17", "1993-04-18", "1993-04-19", "1993-04-20", "1993-04-21",
"1993-04-22", "1993-04-23", "1993-04-24", "1993-04-25", "1993-04-26",
"1993-04-27", "1993-04-28", "1993-04-29", "1993-04-30", "1993-05-01",
"1993-05-02", "1993-05-03", "1993-05-04", "1993-05-05", "1993-05-06",
"1993-05-07", "1993-05-08", "1993-05-09", "1993-05-10", "1993-05-11",
"1993-05-12", "1993-05-13", "1993-05-14", "1993-05-15", "1993-05-16",
"1993-05-17", "1993-05-18", "1993-05-19", "1993-05-20", "1993-05-21",
"1993-05-22", "1993-05-23", "1993-05-24", "1993-05-25", "1993-05-26",
"1993-05-27", "1993-05-28", "1993-05-29", "1993-05-30", "1993-05-31",
"1993-06-01", "1993-06-02", "1993-06-03", "1993-06-04", "1993-06-05",
"1993-06-06", "1993-06-07", "1993-06-08", "1993-06-09", "1993-06-10",
"1993-06-11", "1993-06-12", "1993-06-13", "1993-06-14", "1993-06-15",
"1993-06-16", "1993-06-17", "1993-06-18", "1993-06-19", "1993-06-20",
"1993-06-21", "1993-06-22", "1993-06-23", "1993-06-24", "1993-06-25",
"1993-06-26", "1993-06-27", "1993-06-28", "1993-06-29", "1993-06-30",
"1993-07-01", "1993-07-02", "1993-07-03", "1993-07-04", "1993-07-05",
"1993-07-06", "1993-07-07", "1993-07-08", "1993-07-09", "1993-07-10",
"1993-07-11", "1993-07-12", "1993-07-13", "1993-07-14", "1993-07-15",
"1993-07-16", "1993-07-17", "1993-07-18", "1993-07-19", "1993-07-20",
"1993-07-21", "1993-07-22", "1993-07-23", "1993-07-24", "1993-07-25",
"1993-07-26", "1993-07-27", "1993-07-28", "1993-07-29", "1993-07-30",
"1993-07-31", "1993-08-01", "1993-08-02", "1993-08-03", "1993-08-04",
"1993-08-05", "1993-08-06", "1993-08-07", "1993-08-08", "1993-08-09",
"1993-08-10", "1993-08-11", "1993-08-12", "1993-08-13", "1993-08-14",
"1993-08-15", "1993-08-16", "1993-08-17", "1993-08-18", "1993-08-19",
"1993-08-20", "1993-08-21", "1993-08-22", "1993-08-23", "1993-08-24",
"1993-08-25", "1993-08-26", "1993-08-27", "1993-08-28", "1993-08-29",
"1993-08-30", "1993-08-31", "1993-09-01", "1993-09-02", "1993-09-03",
"1993-09-04", "1993-09-05", "1993-09-06", "1993-09-07", "1993-09-08",
"1993-09-09", "1993-09-10", "1993-09-11", "1993-09-12", "1993-09-13",
"1993-09-14", "1993-09-15", "1993-09-16", "1993-09-17", "1993-09-18",
"1993-09-19", "1993-09-20", "1993-09-21", "1993-09-22", "1993-09-23",
"1993-09-24", "1993-09-25", "1993-09-26", "1993-09-27", "1993-09-28",
"1993-09-29", "1993-09-30", "1993-10-01", "1993-10-02", "1993-10-03",
"1993-10-04", "1993-10-05", "1993-10-06", "1993-10-07", "1993-10-08",
"1993-10-09", "1993-10-10", "1993-10-11", "1993-10-12", "1993-10-13",
"1993-10-14", "1993-10-15", "1993-10-16", "1993-10-17", "1993-10-18",
"1993-10-19", "1993-10-20", "1993-10-21", "1993-10-22", "1993-10-23",
"1993-10-24", "1993-10-25", "1993-10-26", "1993-10-27", "1993-10-28",
"1993-10-29", "1993-10-30", "1993-10-31", "1993-11-01", "1993-11-02",
"1993-11-03", "1993-11-04", "1993-11-05", "1993-11-06", "1993-11-07",
"1993-11-08", "1993-11-09", "1993-11-10", "1993-11-11", "1993-11-12",
"1993-11-13", "1993-11-14", "1993-11-15", "1993-11-16", "1993-11-17",
"1993-11-18", "1993-11-19", "1993-11-20", "1993-11-21", "1993-11-22",
"1993-11-23", "1993-11-24", "1993-11-25", "1993-11-26", "1993-11-27",
"1993-11-28", "1993-11-29", "1993-11-30", "1993-12-01", "1993-12-02",
"1993-12-03", "1993-12-04", "1993-12-05", "1993-12-06", "1993-12-07",
"1993-12-08", "1993-12-09", "1993-12-10", "1993-12-11", "1993-12-12",
"1993-12-13", "1993-12-14", "1993-12-15", "1993-12-16", "1993-12-17",
"1993-12-18", "1993-12-19", "1993-12-20", "1993-12-21", "1993-12-22",
"1993-12-23", "1993-12-24", "1993-12-25", "1993-12-26", "1993-12-27",
"1993-12-28", "1993-12-29", "1993-12-30", "1993-12-31", "1994-01-01",
"1994-01-02", "1994-01-03", "1994-01-04", "1994-01-05", "1994-01-06",
"1994-01-07", "1994-01-08", "1994-01-09", "1994-01-10", "1994-01-11",
"1994-01-12", "1994-01-13", "1994-01-14", "1994-01-15", "1994-01-16",
"1994-01-17", "1994-01-18", "1994-01-19", "1994-01-20", "1994-01-21",
"1994-01-22", "1994-01-23", "1994-01-24", "1994-01-25", "1994-01-26",
"1994-01-27", "1994-01-28", "1994-01-29", "1994-01-30", "1994-01-31",
"1994-02-01", "1994-02-02", "1994-02-03", "1994-02-04", "1994-02-05",
"1994-02-06", "1994-02-07", "1994-02-08", "1994-02-09", "1994-02-10",
"1994-02-11", "1994-02-12", "1994-02-13", "1994-02-14", "1994-02-15",
"1994-02-16", "1994-02-17", "1994-02-18", "1994-02-19", "1994-02-20",
"1994-02-21", "1994-02-22", "1994-02-23", "1994-02-24", "1994-02-25",
"1994-02-26", "1994-02-27", "1994-02-28", "1994-03-01", "1994-03-02",
"1994-03-03", "1994-03-04", "1994-03-05", "1994-03-06", "1994-03-07",
"1994-03-08", "1994-03-09", "1994-03-10", "1994-03-11", "1994-03-12",
"1994-03-13", "1994-03-14", "1994-03-15", "1994-03-16", "1994-03-17",
"1994-03-18", "1994-03-19", "1994-03-20", "1994-03-21", "1994-03-22",
"1994-03-23", "1994-03-24", "1994-03-25", "1994-03-26", "1994-03-27",
"1994-03-28", "1994-03-29", "1994-03-30", "1994-03-31", "1994-04-01",
"1994-04-02", "1994-04-03", "1994-04-04", "1994-04-05", "1994-04-06",
"1994-04-07", "1994-04-08", "1994-04-09", "1994-04-10", "1994-04-11",
"1994-04-12", "1994-04-13", "1994-04-14", "1994-04-15", "1994-04-16",
"1994-04-17", "1994-04-18", "1994-04-19", "1994-04-20", "1994-04-21",
"1994-04-22", "1994-04-23", "1994-04-24", "1994-04-25", "1994-04-26",
"1994-04-27", "1994-04-28", "1994-04-29", "1994-04-30", "1994-05-01",
"1994-05-02", "1994-05-03", "1994-05-04", "1994-05-05", "1994-05-06",
"1994-05-07", "1994-05-08", "1994-05-09", "1994-05-10", "1994-05-11",
"1994-05-12", "1994-05-13", "1994-05-14", "1994-05-15", "1994-05-16",
"1994-05-17", "1994-05-18", "1994-05-19", "1994-05-20", "1994-05-21",
"1994-05-22", "1994-05-23", "1994-05-24", "1994-05-25", "1994-05-26",
"1994-05-27", "1994-05-28", "1994-05-29", "1994-05-30", "1994-05-31",
"1994-06-01", "1994-06-02", "1994-06-03", "1994-06-04", "1994-06-05",
"1994-06-06", "1994-06-07", "1994-06-08", "1994-06-09", "1994-06-10",
"1994-06-11", "1994-06-12", "1994-06-13", "1994-06-14", "1994-06-15",
"1994-06-16", "1994-06-17", "1994-06-18", "1994-06-19", "1994-06-20",
"1994-06-21", "1994-06-22", "1994-06-23", "1994-06-24", "1994-06-25",
"1994-06-26", "1994-06-27", "1994-06-28", "1994-06-29", "1994-06-30",
"1994-07-01", "1994-07-02", "1994-07-03", "1994-07-04", "1994-07-05",
"1994-07-06", "1994-07-07", "1994-07-08", "1994-07-09", "1994-07-10",
"1994-07-11", "1994-07-12", "1994-07-13", "1994-07-14", "1994-07-15",
"1994-07-16", "1994-07-17", "1994-07-18", "1994-07-19", "1994-07-20",
"1994-07-21", "1994-07-22", "1994-07-23", "1994-07-24", "1994-07-25",
"1994-07-26", "1994-07-27", "1994-07-28", "1994-07-29", "1994-07-30",
"1994-07-31", "1994-08-01", "1994-08-02", "1994-08-03", "1994-08-04",
"1994-08-05", "1994-08-06", "1994-08-07", "1994-08-08", "1994-08-09",
"1994-08-10", "1994-08-11", "1994-08-12", "1994-08-13", "1994-08-14",
"1994-08-15", "1994-08-16", "1994-08-17", "1994-08-18", "1994-08-19",
"1994-08-20", "1994-08-21", "1994-08-22", "1994-08-23", "1994-08-24",
"1994-08-25", "1994-08-26", "1994-08-27", "1994-08-28", "1994-08-29",
"1994-08-30", "1994-08-31", "1994-09-01", "1994-09-02", "1994-09-03",
"1994-09-04", "1994-09-05", "1994-09-06", "1994-09-07", "1994-09-08",
"1994-09-09", "1994-09-10", "1994-09-11", "1994-09-12", "1994-09-13",
"1994-09-14", "1994-09-15", "1994-09-16", "1994-09-17", "1994-09-18",
"1994-09-19", "1994-09-20", "1994-09-21", "1994-09-22", "1994-09-23",
"1994-09-24", "1994-09-25", "1994-09-26", "1994-09-27", "1994-09-28",
"1994-09-29", "1994-09-30", "1994-10-01", "1994-10-02", "1994-10-03",
"1994-10-04", "1994-10-05", "1994-10-06", "1994-10-07", "1994-10-08",
"1994-10-09", "1994-10-10", "1994-10-11", "1994-10-12", "1994-10-13",
"1994-10-14", "1994-10-15", "1994-10-16", "1994-10-17", "1994-10-18",
"1994-10-19", "1994-10-20", "1994-10-21", "1994-10-22", "1994-10-23",
"1994-10-24", "1994-10-25", "1994-10-26", "1994-10-27", "1994-10-28",
"1994-10-29", "1994-10-30", "1994-10-31", "1994-11-01", "1994-11-02",
"1994-11-03", "1994-11-04", "1994-11-05", "1994-11-06", "1994-11-07",
"1994-11-08", "1994-11-09", "1994-11-10", "1994-11-11", "1994-11-12",
"1994-11-13", "1994-11-14", "1994-11-15", "1994-11-16", "1994-11-17",
"1994-11-18", "1994-11-19", "1994-11-20", "1994-11-21", "1994-11-22",
"1994-11-23", "1994-11-24", "1994-11-25", "1994-11-26", "1994-11-27",
"1994-11-28", "1994-11-29", "1994-11-30", "1994-12-01", "1994-12-02",
"1994-12-03", "1994-12-04", "1994-12-05", "1994-12-06", "1994-12-07",
"1994-12-08", "1994-12-09", "1994-12-10", "1994-12-11", "1994-12-12",
"1994-12-13", "1994-12-14", "1994-12-15", "1994-12-16", "1994-12-17",
"1994-12-18", "1994-12-19", "1994-12-20", "1994-12-21", "1994-12-22",
"1994-12-23", "1994-12-24", "1994-12-25", "1994-12-26", "1994-12-27",
"1994-12-28", "1994-12-29", "1994-12-30", "1994-12-31"), class = "factor"),
Value = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, 2.8, 2.933, 3.6, 4.233, 3.2,
2.5, 3.2, 3.2, 3.5, 4, 4.167, 4.333, 3.5, 5.2, 4.933, 4,
3.667, 3.833, 4, 4.733, 6.5, 6.5, 6.5, 7.4, 7, 7.4, 3.667,
3.2, 4.637, 4, 3.667, 3.467, 3.067, 2.933, 4.6, 5.8, 5.8,
4.5, 4.5, 5.567, 6.1, 3.467, 3.067, 2.933, 4.6, 5.8, 5.8,
4.5, 4.5, 5.567, 6.1, 5.7, 5.8, 5.8, 5.667, 5.933, 4.8, 4.89,
6.033, 6.15, 6.267, 5.2, 3.667, 3.863, 4, 4, 4.167, 4.167,
4.5, 3.2, 4.167, 4.8, 6.2, 4, 3.2, 2.967, 2.8, 3.2, 3.067,
2.8, 3.2, 3.2, 3.7, 3.3, 4.067, 3.833, 3.667, 3.5, 3.2, 3.2,
4, 4, 3.2, 3.833, 3.5, 3.2, 4, 3.5, 3.5, 3.5, 3.2, 4, 4,
4, 4, 4.6, 4.533, 4, 5.2, 4.533, 7.1, 8.2, 8.7, 9.1, 8.7,
9.2, 7.1, 7.4, 7.1, 7.1, 6.5, 6.5, 6.5, 6.033, 5.2, 4.6,
4.8, 4.8, 4.533, 7.1, 6.5, 7.4, 6.9, 6.5, 6.5, 7.233, 11.57,
11.8, 11.2, 11.93, 13.17, 11.2, 10.03, 11.2, 11.2, 6.367,
6.367, 7.133, 13.37, 12.73, 14.4, 12.7, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0.347, 3.43, 0.837, 0.392, 96.04,
27.32, 22.01, 14.48, 13.43, 11.79, 9.62, 13.9, 19.02, 15.18,
0, 134.2, 50.2, 24.43, 15.41, 10.98, 8.693, 7.147, 6.053,
8.027, 6.351, 26.03, 15.16, 11.43, 13.66, 39.58, 57.88, 82.22,
308.7, 522.4, 290.9, 213.7, 169.8, 98.35, 86.81, 86.59, 223.2,
183.4, 93.31, 64.89, 46.83, 39.42, 34.78, 28.7, 27.8, 77.59,
72.42, 51.45, 39.48, 31.93, 46.77, 32.84, 162.4, 355.2, 110,
108, 151, 242.2, 92.26, 91.55, 92.46, 80.54, 80.21, 135.5,
73.15, 57.35, 34.86, 29.23, 60.8, 86.53, 62.78, 56.79, 48.17,
41.46, 53.46, 98.46, 93.91, 160.6, 133.6, 83.39, 72.11, 72.68,
62.78, 40.64, 27.75, 19.47, 11.85, 9, 7.547, 6.013, 5.067,
4.013, 2.967, 2.46, 2.03, 1.75, 1.325, 1.2, 1.32, 1.015,
1.385, 5.01, 10.85, 11.51, 6.307, 8.013, 17.86, 8.653, 6.093,
4.28, 2.92, 2.68, 58.54, 20.24, 29.1, 20.1, 14.92, 12.26,
9.72, 7.8, 6.2, 5.453, 4.28, 3.24, 2.36, 1.8, 1.48, 1.48,
1.88, 3.053, 2.76, 1.92, 1.44, 1.24, 0.96, 0.84, 0.84, 0.72,
0.6, 0.56, 0.44, 0.44, 0.36, 0.24, 0.2, 0.12, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
22.76, 45.19, 58.88, 83.48, 125, 88.22, 71.05, 41.08, 33.05,
30.94, 28.85, 34.23, 34.29, 32.87, 50.43, 35.76, 32.74, 33.84,
34.63, 229.7, 153.3, 87.31, 67.73, 52.9, 44.45, 71.29, 149.8,
146.5, 133.4, 179, 89.96, 74.66, 75.81, 77.72, 72.84, 75.13,
63.54, 52.29, 46.05, 88.07, 181.4, 156.8, 171.6, 101.9, 163.3,
133.9, 117.4, 106.8, 99.63, 164.1, 276.4, 131.7, 67.7, 57.1,
50.08, 43.54, 42.28, 35.44, 36, 66.81, 86.23, 77.09, 88.63,
108.3, 76.16, 59.27, 60.06, 126.9, 80.39, 61.17, 57.14, 51.47,
89.8, 80.4, 63.95, 55.5, 48.83, 46.18, 35.65, 34.74, 37.57,
45.49, 56.34, 79.82, 75.6, 63.65, 58.02, 54.37, 48.09, 44.67,
38.08, 34.24, 32.77, 33.36, 31.75, 32.63, 31.45, 33.07, 30.72,
26.69, 29.4, 29.4, 40.76, 93.01, 74.24, 79, 65.4, 52.99,
45.36, 47.79, 38.08, 36.05, 41.55, 34.39, 32.33, 34.39, 31.75,
31.6, 46.75, 52.29, 65.06, 80.73, 56.8, 53.68, 56.8, 51.25,
62.31, 52.28, 43.97, 36.89, 34.39, 32.92, 31.6, 34.83, 31.16,
29.99, 29.55, 28.52, 26.91, 26.17, 27.35, 24, 23.4, 23.2,
23.2, 23, 22.6, 22, 22, 21.8, 21, 20.8, 20.2, 20.2, 20.2,
20.2, 19.6, 19.6, 19.6, 19, 19, 19, 19, 18.4, 18.4, 18.4,
17.8, 17.8, 17.2, 17.2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7.294, 8.278, 6.037,
7, 5.6, 5.6, 28.39, 4.657, 8, 7.86, 8, 8, 6, 4, 4, 3.5, 2,
1.8, 2, 0.8, 0.8, 0.5, 0.5, 0.8, 1.3, 0.4, 0.8, 0.3, 0, 0,
0, 0, 6, 6, 4, 4.5, 4, 4, 2, 1.5, 1, 0.8, 0.8, 0.8, 0.8,
0.8, 1.5, 0.4, 0.3, 0.4, 0.3, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
0, 0, 2, 0, 0, 0, 0, 0, 2, 2, 0, 2, 0, 2, 2, 2, 0, 0, 0,
0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 20, 95, 125,
150, 205, 155, 100, 85, 32, 23, 17, 14, 16, 12, 29, 205,
470, 266, 204, 170, 200, 205, 100, 110, 130, 95, 110, 155,
300, 325, 236.2, 214, 192.5, 150, 161.2, 154.8, 143.5, 134.8,
144.9, 151.4, 172.6, 158.9, 131.6, 146.5, 127.6, 122.5, 169.8,
116, 106.7, 103, 106, 101.2, 78.1, 34, 28, 24, 19, 16, 15,
16, 70, 65, 38, 27.61, 26.9, 33.86, 70.51, 102.1, 88.38,
102.5, 99.18, 117.1, 135, 150.1, 250.3, 209.5, 163.1, 211.1,
203.1, 192.7, 179.9, 164.6, 145, 129, 162, 130.2, 131.5,
125, 109.6, 110, 100.3, 93.37, 79.81, 31.07, 16.31, 15.64,
15, 13.37, 12.29, 10.03, 8.826, 8.168, 7.148, 7, 6.017, 5.334,
4.768, 11.19, 9.315, 9, 8, 14, 14, 16, 16, 14, 9, 9, 8, 8,
9, 9, 8, 8, 7, 7, 6, 7, 6, 5, 9, 9, 8, 8, 8, 7, 8, 8, 9,
7, 5, 5, 4, 4, 3, 3, 3, 3, 3, 2.5, 2.5, 2.5, 2.5, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA)), class = "data.frame", row.names = c(NA,
-1310L))
问题源于这样一个事实,即 sum
长度为零的向量给你零而不是 NA
。
> sum(vector("numeric",0))
[1] 0
在这种情况下,一个简单的解决方案是将您自己的 sum
版本升级为 return NA
:
mysum <- function(x) if(length(x)==0) return(NA) else return(sum(x))
然后:
head(apply.monthly(Rain, FUN=mysum), 20)
[,1]
1991-06-30 NA
1991-07-31 NA
1991-08-31 NA
1991-09-30 NA
1991-10-31 NA
1991-11-30 NA
1991-12-31 NA
1992-01-31 136.003
1992-02-29 143.441
1992-03-31 119.099
1992-04-30 160.499
1992-05-31 267.466
1992-06-30 247.796
1992-07-31 2945.751
1992-08-31 2654.740
1992-09-30 1035.112
1992-10-31 279.582
1992-11-30 6.320
1992-12-31 0.000
1993-01-31 0.000
我每天都有包含 0 和 NA 值的时间序列数据。我想使用 R 中的 xts
包将其转换为每月数据。我使用以下代码
xx=as.Date(dat$Date)
yy=dat$Value
Rain <- xts(yy, order.by = xx)
apply.monthly(Rain, FUN=sum, na.rm=TRUE)
它为 NA 值返回零。由于数据也包含零,因此很难区分零值和 NA 值。当我使用 na.pass=T
like
apply.monthly(Rain, FUN=sum, na.pass=TRUE)
它给了我 NA,但零被 1 代替了。
我希望每个月的值都包含NA,原时间序列有NA,时间序列有0,应该保持0。如何实现?
这是数据
dat <-structure(list(Date = structure(1:1310, .Label = c("1991-06-01",
"1991-06-02", "1991-06-03", "1991-06-04", "1991-06-05", "1991-06-06",
"1991-06-07", "1991-06-08", "1991-06-09", "1991-06-10", "1991-06-11",
"1991-06-12", "1991-06-13", "1991-06-14", "1991-06-15", "1991-06-16",
"1991-06-17", "1991-06-18", "1991-06-19", "1991-06-20", "1991-06-21",
"1991-06-22", "1991-06-23", "1991-06-24", "1991-06-25", "1991-06-26",
"1991-06-27", "1991-06-28", "1991-06-29", "1991-06-30", "1991-07-01",
"1991-07-02", "1991-07-03", "1991-07-04", "1991-07-05", "1991-07-06",
"1991-07-07", "1991-07-08", "1991-07-09", "1991-07-10", "1991-07-11",
"1991-07-12", "1991-07-13", "1991-07-14", "1991-07-15", "1991-07-16",
"1991-07-17", "1991-07-18", "1991-07-19", "1991-07-20", "1991-07-21",
"1991-07-22", "1991-07-23", "1991-07-24", "1991-07-25", "1991-07-26",
"1991-07-27", "1991-07-28", "1991-07-29", "1991-07-30", "1991-07-31",
"1991-08-01", "1991-08-02", "1991-08-03", "1991-08-04", "1991-08-05",
"1991-08-06", "1991-08-07", "1991-08-08", "1991-08-09", "1991-08-10",
"1991-08-11", "1991-08-12", "1991-08-13", "1991-08-14", "1991-08-15",
"1991-08-16", "1991-08-17", "1991-08-18", "1991-08-19", "1991-08-20",
"1991-08-21", "1991-08-22", "1991-08-23", "1991-08-24", "1991-08-25",
"1991-08-26", "1991-08-27", "1991-08-28", "1991-08-29", "1991-08-30",
"1991-08-31", "1991-09-01", "1991-09-02", "1991-09-03", "1991-09-04",
"1991-09-05", "1991-09-06", "1991-09-07", "1991-09-08", "1991-09-09",
"1991-09-10", "1991-09-11", "1991-09-12", "1991-09-13", "1991-09-14",
"1991-09-15", "1991-09-16", "1991-09-17", "1991-09-18", "1991-09-19",
"1991-09-20", "1991-09-21", "1991-09-22", "1991-09-23", "1991-09-24",
"1991-09-25", "1991-09-26", "1991-09-27", "1991-09-28", "1991-09-29",
"1991-09-30", "1991-10-01", "1991-10-02", "1991-10-03", "1991-10-04",
"1991-10-05", "1991-10-06", "1991-10-07", "1991-10-08", "1991-10-09",
"1991-10-10", "1991-10-11", "1991-10-12", "1991-10-13", "1991-10-14",
"1991-10-15", "1991-10-16", "1991-10-17", "1991-10-18", "1991-10-19",
"1991-10-20", "1991-10-21", "1991-10-22", "1991-10-23", "1991-10-24",
"1991-10-25", "1991-10-26", "1991-10-27", "1991-10-28", "1991-10-29",
"1991-10-30", "1991-10-31", "1991-11-01", "1991-11-02", "1991-11-03",
"1991-11-04", "1991-11-05", "1991-11-06", "1991-11-07", "1991-11-08",
"1991-11-09", "1991-11-10", "1991-11-11", "1991-11-12", "1991-11-13",
"1991-11-14", "1991-11-15", "1991-11-16", "1991-11-17", "1991-11-18",
"1991-11-19", "1991-11-20", "1991-11-21", "1991-11-22", "1991-11-23",
"1991-11-24", "1991-11-25", "1991-11-26", "1991-11-27", "1991-11-28",
"1991-11-29", "1991-11-30", "1991-12-01", "1991-12-02", "1991-12-03",
"1991-12-04", "1991-12-05", "1991-12-06", "1991-12-07", "1991-12-08",
"1991-12-09", "1991-12-10", "1991-12-11", "1991-12-12", "1991-12-13",
"1991-12-14", "1991-12-15", "1991-12-16", "1991-12-17", "1991-12-18",
"1991-12-19", "1991-12-20", "1991-12-21", "1991-12-22", "1991-12-23",
"1991-12-24", "1991-12-25", "1991-12-26", "1991-12-27", "1991-12-28",
"1991-12-29", "1991-12-30", "1991-12-31", "1992-01-01", "1992-01-02",
"1992-01-03", "1992-01-04", "1992-01-05", "1992-01-06", "1992-01-07",
"1992-01-08", "1992-01-09", "1992-01-10", "1992-01-11", "1992-01-12",
"1992-01-13", "1992-01-14", "1992-01-15", "1992-01-16", "1992-01-17",
"1992-01-18", "1992-01-19", "1992-01-20", "1992-01-21", "1992-01-22",
"1992-01-23", "1992-01-24", "1992-01-25", "1992-01-26", "1992-01-27",
"1992-01-28", "1992-01-29", "1992-01-30", "1992-01-31", "1992-02-01",
"1992-02-02", "1992-02-03", "1992-02-04", "1992-02-05", "1992-02-06",
"1992-02-07", "1992-02-08", "1992-02-09", "1992-02-10", "1992-02-11",
"1992-02-12", "1992-02-13", "1992-02-14", "1992-02-15", "1992-02-16",
"1992-02-17", "1992-02-18", "1992-02-19", "1992-02-20", "1992-02-21",
"1992-02-22", "1992-02-23", "1992-02-24", "1992-02-25", "1992-02-26",
"1992-02-27", "1992-02-28", "1992-02-29", "1992-03-01", "1992-03-02",
"1992-03-03", "1992-03-04", "1992-03-05", "1992-03-06", "1992-03-07",
"1992-03-08", "1992-03-09", "1992-03-10", "1992-03-11", "1992-03-12",
"1992-03-13", "1992-03-14", "1992-03-15", "1992-03-16", "1992-03-17",
"1992-03-18", "1992-03-19", "1992-03-20", "1992-03-21", "1992-03-22",
"1992-03-23", "1992-03-24", "1992-03-25", "1992-03-26", "1992-03-27",
"1992-03-28", "1992-03-29", "1992-03-30", "1992-03-31", "1992-04-01",
"1992-04-02", "1992-04-03", "1992-04-04", "1992-04-05", "1992-04-06",
"1992-04-07", "1992-04-08", "1992-04-09", "1992-04-10", "1992-04-11",
"1992-04-12", "1992-04-13", "1992-04-14", "1992-04-15", "1992-04-16",
"1992-04-17", "1992-04-18", "1992-04-19", "1992-04-20", "1992-04-21",
"1992-04-22", "1992-04-23", "1992-04-24", "1992-04-25", "1992-04-26",
"1992-04-27", "1992-04-28", "1992-04-29", "1992-04-30", "1992-05-01",
"1992-05-02", "1992-05-03", "1992-05-04", "1992-05-05", "1992-05-06",
"1992-05-07", "1992-05-08", "1992-05-09", "1992-05-10", "1992-05-11",
"1992-05-12", "1992-05-13", "1992-05-14", "1992-05-15", "1992-05-16",
"1992-05-17", "1992-05-18", "1992-05-19", "1992-05-20", "1992-05-21",
"1992-05-22", "1992-05-23", "1992-05-24", "1992-05-25", "1992-05-26",
"1992-05-27", "1992-05-28", "1992-05-29", "1992-05-30", "1992-05-31",
"1992-06-01", "1992-06-02", "1992-06-03", "1992-06-04", "1992-06-05",
"1992-06-06", "1992-06-07", "1992-06-08", "1992-06-09", "1992-06-10",
"1992-06-11", "1992-06-12", "1992-06-13", "1992-06-14", "1992-06-15",
"1992-06-16", "1992-06-17", "1992-06-18", "1992-06-19", "1992-06-20",
"1992-06-21", "1992-06-22", "1992-06-23", "1992-06-24", "1992-06-25",
"1992-06-26", "1992-06-27", "1992-06-28", "1992-06-29", "1992-06-30",
"1992-07-01", "1992-07-02", "1992-07-03", "1992-07-04", "1992-07-05",
"1992-07-06", "1992-07-07", "1992-07-08", "1992-07-09", "1992-07-10",
"1992-07-11", "1992-07-12", "1992-07-13", "1992-07-14", "1992-07-15",
"1992-07-16", "1992-07-17", "1992-07-18", "1992-07-19", "1992-07-20",
"1992-07-21", "1992-07-22", "1992-07-23", "1992-07-24", "1992-07-25",
"1992-07-26", "1992-07-27", "1992-07-28", "1992-07-29", "1992-07-30",
"1992-07-31", "1992-08-01", "1992-08-02", "1992-08-03", "1992-08-04",
"1992-08-05", "1992-08-06", "1992-08-07", "1992-08-08", "1992-08-09",
"1992-08-10", "1992-08-11", "1992-08-12", "1992-08-13", "1992-08-14",
"1992-08-15", "1992-08-16", "1992-08-17", "1992-08-18", "1992-08-19",
"1992-08-20", "1992-08-21", "1992-08-22", "1992-08-23", "1992-08-24",
"1992-08-25", "1992-08-26", "1992-08-27", "1992-08-28", "1992-08-29",
"1992-08-30", "1992-08-31", "1992-09-01", "1992-09-02", "1992-09-03",
"1992-09-04", "1992-09-05", "1992-09-06", "1992-09-07", "1992-09-08",
"1992-09-09", "1992-09-10", "1992-09-11", "1992-09-12", "1992-09-13",
"1992-09-14", "1992-09-15", "1992-09-16", "1992-09-17", "1992-09-18",
"1992-09-19", "1992-09-20", "1992-09-21", "1992-09-22", "1992-09-23",
"1992-09-24", "1992-09-25", "1992-09-26", "1992-09-27", "1992-09-28",
"1992-09-29", "1992-09-30", "1992-10-01", "1992-10-02", "1992-10-03",
"1992-10-04", "1992-10-05", "1992-10-06", "1992-10-07", "1992-10-08",
"1992-10-09", "1992-10-10", "1992-10-11", "1992-10-12", "1992-10-13",
"1992-10-14", "1992-10-15", "1992-10-16", "1992-10-17", "1992-10-18",
"1992-10-19", "1992-10-20", "1992-10-21", "1992-10-22", "1992-10-23",
"1992-10-24", "1992-10-25", "1992-10-26", "1992-10-27", "1992-10-28",
"1992-10-29", "1992-10-30", "1992-10-31", "1992-11-01", "1992-11-02",
"1992-11-03", "1992-11-04", "1992-11-05", "1992-11-06", "1992-11-07",
"1992-11-08", "1992-11-09", "1992-11-10", "1992-11-11", "1992-11-12",
"1992-11-13", "1992-11-14", "1992-11-15", "1992-11-16", "1992-11-17",
"1992-11-18", "1992-11-19", "1992-11-20", "1992-11-21", "1992-11-22",
"1992-11-23", "1992-11-24", "1992-11-25", "1992-11-26", "1992-11-27",
"1992-11-28", "1992-11-29", "1992-11-30", "1992-12-01", "1992-12-02",
"1992-12-03", "1992-12-04", "1992-12-05", "1992-12-06", "1992-12-07",
"1992-12-08", "1992-12-09", "1992-12-10", "1992-12-11", "1992-12-12",
"1992-12-13", "1992-12-14", "1992-12-15", "1992-12-16", "1992-12-17",
"1992-12-18", "1992-12-19", "1992-12-20", "1992-12-21", "1992-12-22",
"1992-12-23", "1992-12-24", "1992-12-25", "1992-12-26", "1992-12-27",
"1992-12-28", "1992-12-29", "1992-12-30", "1992-12-31", "1993-01-01",
"1993-01-02", "1993-01-03", "1993-01-04", "1993-01-05", "1993-01-06",
"1993-01-07", "1993-01-08", "1993-01-09", "1993-01-10", "1993-01-11",
"1993-01-12", "1993-01-13", "1993-01-14", "1993-01-15", "1993-01-16",
"1993-01-17", "1993-01-18", "1993-01-19", "1993-01-20", "1993-01-21",
"1993-01-22", "1993-01-23", "1993-01-24", "1993-01-25", "1993-01-26",
"1993-01-27", "1993-01-28", "1993-01-29", "1993-01-30", "1993-01-31",
"1993-02-01", "1993-02-02", "1993-02-03", "1993-02-04", "1993-02-05",
"1993-02-06", "1993-02-07", "1993-02-08", "1993-02-09", "1993-02-10",
"1993-02-11", "1993-02-12", "1993-02-13", "1993-02-14", "1993-02-15",
"1993-02-16", "1993-02-17", "1993-02-18", "1993-02-19", "1993-02-20",
"1993-02-21", "1993-02-22", "1993-02-23", "1993-02-24", "1993-02-25",
"1993-02-26", "1993-02-27", "1993-02-28", "1993-03-01", "1993-03-02",
"1993-03-03", "1993-03-04", "1993-03-05", "1993-03-06", "1993-03-07",
"1993-03-08", "1993-03-09", "1993-03-10", "1993-03-11", "1993-03-12",
"1993-03-13", "1993-03-14", "1993-03-15", "1993-03-16", "1993-03-17",
"1993-03-18", "1993-03-19", "1993-03-20", "1993-03-21", "1993-03-22",
"1993-03-23", "1993-03-24", "1993-03-25", "1993-03-26", "1993-03-27",
"1993-03-28", "1993-03-29", "1993-03-30", "1993-03-31", "1993-04-01",
"1993-04-02", "1993-04-03", "1993-04-04", "1993-04-05", "1993-04-06",
"1993-04-07", "1993-04-08", "1993-04-09", "1993-04-10", "1993-04-11",
"1993-04-12", "1993-04-13", "1993-04-14", "1993-04-15", "1993-04-16",
"1993-04-17", "1993-04-18", "1993-04-19", "1993-04-20", "1993-04-21",
"1993-04-22", "1993-04-23", "1993-04-24", "1993-04-25", "1993-04-26",
"1993-04-27", "1993-04-28", "1993-04-29", "1993-04-30", "1993-05-01",
"1993-05-02", "1993-05-03", "1993-05-04", "1993-05-05", "1993-05-06",
"1993-05-07", "1993-05-08", "1993-05-09", "1993-05-10", "1993-05-11",
"1993-05-12", "1993-05-13", "1993-05-14", "1993-05-15", "1993-05-16",
"1993-05-17", "1993-05-18", "1993-05-19", "1993-05-20", "1993-05-21",
"1993-05-22", "1993-05-23", "1993-05-24", "1993-05-25", "1993-05-26",
"1993-05-27", "1993-05-28", "1993-05-29", "1993-05-30", "1993-05-31",
"1993-06-01", "1993-06-02", "1993-06-03", "1993-06-04", "1993-06-05",
"1993-06-06", "1993-06-07", "1993-06-08", "1993-06-09", "1993-06-10",
"1993-06-11", "1993-06-12", "1993-06-13", "1993-06-14", "1993-06-15",
"1993-06-16", "1993-06-17", "1993-06-18", "1993-06-19", "1993-06-20",
"1993-06-21", "1993-06-22", "1993-06-23", "1993-06-24", "1993-06-25",
"1993-06-26", "1993-06-27", "1993-06-28", "1993-06-29", "1993-06-30",
"1993-07-01", "1993-07-02", "1993-07-03", "1993-07-04", "1993-07-05",
"1993-07-06", "1993-07-07", "1993-07-08", "1993-07-09", "1993-07-10",
"1993-07-11", "1993-07-12", "1993-07-13", "1993-07-14", "1993-07-15",
"1993-07-16", "1993-07-17", "1993-07-18", "1993-07-19", "1993-07-20",
"1993-07-21", "1993-07-22", "1993-07-23", "1993-07-24", "1993-07-25",
"1993-07-26", "1993-07-27", "1993-07-28", "1993-07-29", "1993-07-30",
"1993-07-31", "1993-08-01", "1993-08-02", "1993-08-03", "1993-08-04",
"1993-08-05", "1993-08-06", "1993-08-07", "1993-08-08", "1993-08-09",
"1993-08-10", "1993-08-11", "1993-08-12", "1993-08-13", "1993-08-14",
"1993-08-15", "1993-08-16", "1993-08-17", "1993-08-18", "1993-08-19",
"1993-08-20", "1993-08-21", "1993-08-22", "1993-08-23", "1993-08-24",
"1993-08-25", "1993-08-26", "1993-08-27", "1993-08-28", "1993-08-29",
"1993-08-30", "1993-08-31", "1993-09-01", "1993-09-02", "1993-09-03",
"1993-09-04", "1993-09-05", "1993-09-06", "1993-09-07", "1993-09-08",
"1993-09-09", "1993-09-10", "1993-09-11", "1993-09-12", "1993-09-13",
"1993-09-14", "1993-09-15", "1993-09-16", "1993-09-17", "1993-09-18",
"1993-09-19", "1993-09-20", "1993-09-21", "1993-09-22", "1993-09-23",
"1993-09-24", "1993-09-25", "1993-09-26", "1993-09-27", "1993-09-28",
"1993-09-29", "1993-09-30", "1993-10-01", "1993-10-02", "1993-10-03",
"1993-10-04", "1993-10-05", "1993-10-06", "1993-10-07", "1993-10-08",
"1993-10-09", "1993-10-10", "1993-10-11", "1993-10-12", "1993-10-13",
"1993-10-14", "1993-10-15", "1993-10-16", "1993-10-17", "1993-10-18",
"1993-10-19", "1993-10-20", "1993-10-21", "1993-10-22", "1993-10-23",
"1993-10-24", "1993-10-25", "1993-10-26", "1993-10-27", "1993-10-28",
"1993-10-29", "1993-10-30", "1993-10-31", "1993-11-01", "1993-11-02",
"1993-11-03", "1993-11-04", "1993-11-05", "1993-11-06", "1993-11-07",
"1993-11-08", "1993-11-09", "1993-11-10", "1993-11-11", "1993-11-12",
"1993-11-13", "1993-11-14", "1993-11-15", "1993-11-16", "1993-11-17",
"1993-11-18", "1993-11-19", "1993-11-20", "1993-11-21", "1993-11-22",
"1993-11-23", "1993-11-24", "1993-11-25", "1993-11-26", "1993-11-27",
"1993-11-28", "1993-11-29", "1993-11-30", "1993-12-01", "1993-12-02",
"1993-12-03", "1993-12-04", "1993-12-05", "1993-12-06", "1993-12-07",
"1993-12-08", "1993-12-09", "1993-12-10", "1993-12-11", "1993-12-12",
"1993-12-13", "1993-12-14", "1993-12-15", "1993-12-16", "1993-12-17",
"1993-12-18", "1993-12-19", "1993-12-20", "1993-12-21", "1993-12-22",
"1993-12-23", "1993-12-24", "1993-12-25", "1993-12-26", "1993-12-27",
"1993-12-28", "1993-12-29", "1993-12-30", "1993-12-31", "1994-01-01",
"1994-01-02", "1994-01-03", "1994-01-04", "1994-01-05", "1994-01-06",
"1994-01-07", "1994-01-08", "1994-01-09", "1994-01-10", "1994-01-11",
"1994-01-12", "1994-01-13", "1994-01-14", "1994-01-15", "1994-01-16",
"1994-01-17", "1994-01-18", "1994-01-19", "1994-01-20", "1994-01-21",
"1994-01-22", "1994-01-23", "1994-01-24", "1994-01-25", "1994-01-26",
"1994-01-27", "1994-01-28", "1994-01-29", "1994-01-30", "1994-01-31",
"1994-02-01", "1994-02-02", "1994-02-03", "1994-02-04", "1994-02-05",
"1994-02-06", "1994-02-07", "1994-02-08", "1994-02-09", "1994-02-10",
"1994-02-11", "1994-02-12", "1994-02-13", "1994-02-14", "1994-02-15",
"1994-02-16", "1994-02-17", "1994-02-18", "1994-02-19", "1994-02-20",
"1994-02-21", "1994-02-22", "1994-02-23", "1994-02-24", "1994-02-25",
"1994-02-26", "1994-02-27", "1994-02-28", "1994-03-01", "1994-03-02",
"1994-03-03", "1994-03-04", "1994-03-05", "1994-03-06", "1994-03-07",
"1994-03-08", "1994-03-09", "1994-03-10", "1994-03-11", "1994-03-12",
"1994-03-13", "1994-03-14", "1994-03-15", "1994-03-16", "1994-03-17",
"1994-03-18", "1994-03-19", "1994-03-20", "1994-03-21", "1994-03-22",
"1994-03-23", "1994-03-24", "1994-03-25", "1994-03-26", "1994-03-27",
"1994-03-28", "1994-03-29", "1994-03-30", "1994-03-31", "1994-04-01",
"1994-04-02", "1994-04-03", "1994-04-04", "1994-04-05", "1994-04-06",
"1994-04-07", "1994-04-08", "1994-04-09", "1994-04-10", "1994-04-11",
"1994-04-12", "1994-04-13", "1994-04-14", "1994-04-15", "1994-04-16",
"1994-04-17", "1994-04-18", "1994-04-19", "1994-04-20", "1994-04-21",
"1994-04-22", "1994-04-23", "1994-04-24", "1994-04-25", "1994-04-26",
"1994-04-27", "1994-04-28", "1994-04-29", "1994-04-30", "1994-05-01",
"1994-05-02", "1994-05-03", "1994-05-04", "1994-05-05", "1994-05-06",
"1994-05-07", "1994-05-08", "1994-05-09", "1994-05-10", "1994-05-11",
"1994-05-12", "1994-05-13", "1994-05-14", "1994-05-15", "1994-05-16",
"1994-05-17", "1994-05-18", "1994-05-19", "1994-05-20", "1994-05-21",
"1994-05-22", "1994-05-23", "1994-05-24", "1994-05-25", "1994-05-26",
"1994-05-27", "1994-05-28", "1994-05-29", "1994-05-30", "1994-05-31",
"1994-06-01", "1994-06-02", "1994-06-03", "1994-06-04", "1994-06-05",
"1994-06-06", "1994-06-07", "1994-06-08", "1994-06-09", "1994-06-10",
"1994-06-11", "1994-06-12", "1994-06-13", "1994-06-14", "1994-06-15",
"1994-06-16", "1994-06-17", "1994-06-18", "1994-06-19", "1994-06-20",
"1994-06-21", "1994-06-22", "1994-06-23", "1994-06-24", "1994-06-25",
"1994-06-26", "1994-06-27", "1994-06-28", "1994-06-29", "1994-06-30",
"1994-07-01", "1994-07-02", "1994-07-03", "1994-07-04", "1994-07-05",
"1994-07-06", "1994-07-07", "1994-07-08", "1994-07-09", "1994-07-10",
"1994-07-11", "1994-07-12", "1994-07-13", "1994-07-14", "1994-07-15",
"1994-07-16", "1994-07-17", "1994-07-18", "1994-07-19", "1994-07-20",
"1994-07-21", "1994-07-22", "1994-07-23", "1994-07-24", "1994-07-25",
"1994-07-26", "1994-07-27", "1994-07-28", "1994-07-29", "1994-07-30",
"1994-07-31", "1994-08-01", "1994-08-02", "1994-08-03", "1994-08-04",
"1994-08-05", "1994-08-06", "1994-08-07", "1994-08-08", "1994-08-09",
"1994-08-10", "1994-08-11", "1994-08-12", "1994-08-13", "1994-08-14",
"1994-08-15", "1994-08-16", "1994-08-17", "1994-08-18", "1994-08-19",
"1994-08-20", "1994-08-21", "1994-08-22", "1994-08-23", "1994-08-24",
"1994-08-25", "1994-08-26", "1994-08-27", "1994-08-28", "1994-08-29",
"1994-08-30", "1994-08-31", "1994-09-01", "1994-09-02", "1994-09-03",
"1994-09-04", "1994-09-05", "1994-09-06", "1994-09-07", "1994-09-08",
"1994-09-09", "1994-09-10", "1994-09-11", "1994-09-12", "1994-09-13",
"1994-09-14", "1994-09-15", "1994-09-16", "1994-09-17", "1994-09-18",
"1994-09-19", "1994-09-20", "1994-09-21", "1994-09-22", "1994-09-23",
"1994-09-24", "1994-09-25", "1994-09-26", "1994-09-27", "1994-09-28",
"1994-09-29", "1994-09-30", "1994-10-01", "1994-10-02", "1994-10-03",
"1994-10-04", "1994-10-05", "1994-10-06", "1994-10-07", "1994-10-08",
"1994-10-09", "1994-10-10", "1994-10-11", "1994-10-12", "1994-10-13",
"1994-10-14", "1994-10-15", "1994-10-16", "1994-10-17", "1994-10-18",
"1994-10-19", "1994-10-20", "1994-10-21", "1994-10-22", "1994-10-23",
"1994-10-24", "1994-10-25", "1994-10-26", "1994-10-27", "1994-10-28",
"1994-10-29", "1994-10-30", "1994-10-31", "1994-11-01", "1994-11-02",
"1994-11-03", "1994-11-04", "1994-11-05", "1994-11-06", "1994-11-07",
"1994-11-08", "1994-11-09", "1994-11-10", "1994-11-11", "1994-11-12",
"1994-11-13", "1994-11-14", "1994-11-15", "1994-11-16", "1994-11-17",
"1994-11-18", "1994-11-19", "1994-11-20", "1994-11-21", "1994-11-22",
"1994-11-23", "1994-11-24", "1994-11-25", "1994-11-26", "1994-11-27",
"1994-11-28", "1994-11-29", "1994-11-30", "1994-12-01", "1994-12-02",
"1994-12-03", "1994-12-04", "1994-12-05", "1994-12-06", "1994-12-07",
"1994-12-08", "1994-12-09", "1994-12-10", "1994-12-11", "1994-12-12",
"1994-12-13", "1994-12-14", "1994-12-15", "1994-12-16", "1994-12-17",
"1994-12-18", "1994-12-19", "1994-12-20", "1994-12-21", "1994-12-22",
"1994-12-23", "1994-12-24", "1994-12-25", "1994-12-26", "1994-12-27",
"1994-12-28", "1994-12-29", "1994-12-30", "1994-12-31"), class = "factor"),
Value = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, 2.8, 2.933, 3.6, 4.233, 3.2,
2.5, 3.2, 3.2, 3.5, 4, 4.167, 4.333, 3.5, 5.2, 4.933, 4,
3.667, 3.833, 4, 4.733, 6.5, 6.5, 6.5, 7.4, 7, 7.4, 3.667,
3.2, 4.637, 4, 3.667, 3.467, 3.067, 2.933, 4.6, 5.8, 5.8,
4.5, 4.5, 5.567, 6.1, 3.467, 3.067, 2.933, 4.6, 5.8, 5.8,
4.5, 4.5, 5.567, 6.1, 5.7, 5.8, 5.8, 5.667, 5.933, 4.8, 4.89,
6.033, 6.15, 6.267, 5.2, 3.667, 3.863, 4, 4, 4.167, 4.167,
4.5, 3.2, 4.167, 4.8, 6.2, 4, 3.2, 2.967, 2.8, 3.2, 3.067,
2.8, 3.2, 3.2, 3.7, 3.3, 4.067, 3.833, 3.667, 3.5, 3.2, 3.2,
4, 4, 3.2, 3.833, 3.5, 3.2, 4, 3.5, 3.5, 3.5, 3.2, 4, 4,
4, 4, 4.6, 4.533, 4, 5.2, 4.533, 7.1, 8.2, 8.7, 9.1, 8.7,
9.2, 7.1, 7.4, 7.1, 7.1, 6.5, 6.5, 6.5, 6.033, 5.2, 4.6,
4.8, 4.8, 4.533, 7.1, 6.5, 7.4, 6.9, 6.5, 6.5, 7.233, 11.57,
11.8, 11.2, 11.93, 13.17, 11.2, 10.03, 11.2, 11.2, 6.367,
6.367, 7.133, 13.37, 12.73, 14.4, 12.7, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0.347, 3.43, 0.837, 0.392, 96.04,
27.32, 22.01, 14.48, 13.43, 11.79, 9.62, 13.9, 19.02, 15.18,
0, 134.2, 50.2, 24.43, 15.41, 10.98, 8.693, 7.147, 6.053,
8.027, 6.351, 26.03, 15.16, 11.43, 13.66, 39.58, 57.88, 82.22,
308.7, 522.4, 290.9, 213.7, 169.8, 98.35, 86.81, 86.59, 223.2,
183.4, 93.31, 64.89, 46.83, 39.42, 34.78, 28.7, 27.8, 77.59,
72.42, 51.45, 39.48, 31.93, 46.77, 32.84, 162.4, 355.2, 110,
108, 151, 242.2, 92.26, 91.55, 92.46, 80.54, 80.21, 135.5,
73.15, 57.35, 34.86, 29.23, 60.8, 86.53, 62.78, 56.79, 48.17,
41.46, 53.46, 98.46, 93.91, 160.6, 133.6, 83.39, 72.11, 72.68,
62.78, 40.64, 27.75, 19.47, 11.85, 9, 7.547, 6.013, 5.067,
4.013, 2.967, 2.46, 2.03, 1.75, 1.325, 1.2, 1.32, 1.015,
1.385, 5.01, 10.85, 11.51, 6.307, 8.013, 17.86, 8.653, 6.093,
4.28, 2.92, 2.68, 58.54, 20.24, 29.1, 20.1, 14.92, 12.26,
9.72, 7.8, 6.2, 5.453, 4.28, 3.24, 2.36, 1.8, 1.48, 1.48,
1.88, 3.053, 2.76, 1.92, 1.44, 1.24, 0.96, 0.84, 0.84, 0.72,
0.6, 0.56, 0.44, 0.44, 0.36, 0.24, 0.2, 0.12, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
22.76, 45.19, 58.88, 83.48, 125, 88.22, 71.05, 41.08, 33.05,
30.94, 28.85, 34.23, 34.29, 32.87, 50.43, 35.76, 32.74, 33.84,
34.63, 229.7, 153.3, 87.31, 67.73, 52.9, 44.45, 71.29, 149.8,
146.5, 133.4, 179, 89.96, 74.66, 75.81, 77.72, 72.84, 75.13,
63.54, 52.29, 46.05, 88.07, 181.4, 156.8, 171.6, 101.9, 163.3,
133.9, 117.4, 106.8, 99.63, 164.1, 276.4, 131.7, 67.7, 57.1,
50.08, 43.54, 42.28, 35.44, 36, 66.81, 86.23, 77.09, 88.63,
108.3, 76.16, 59.27, 60.06, 126.9, 80.39, 61.17, 57.14, 51.47,
89.8, 80.4, 63.95, 55.5, 48.83, 46.18, 35.65, 34.74, 37.57,
45.49, 56.34, 79.82, 75.6, 63.65, 58.02, 54.37, 48.09, 44.67,
38.08, 34.24, 32.77, 33.36, 31.75, 32.63, 31.45, 33.07, 30.72,
26.69, 29.4, 29.4, 40.76, 93.01, 74.24, 79, 65.4, 52.99,
45.36, 47.79, 38.08, 36.05, 41.55, 34.39, 32.33, 34.39, 31.75,
31.6, 46.75, 52.29, 65.06, 80.73, 56.8, 53.68, 56.8, 51.25,
62.31, 52.28, 43.97, 36.89, 34.39, 32.92, 31.6, 34.83, 31.16,
29.99, 29.55, 28.52, 26.91, 26.17, 27.35, 24, 23.4, 23.2,
23.2, 23, 22.6, 22, 22, 21.8, 21, 20.8, 20.2, 20.2, 20.2,
20.2, 19.6, 19.6, 19.6, 19, 19, 19, 19, 18.4, 18.4, 18.4,
17.8, 17.8, 17.2, 17.2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7.294, 8.278, 6.037,
7, 5.6, 5.6, 28.39, 4.657, 8, 7.86, 8, 8, 6, 4, 4, 3.5, 2,
1.8, 2, 0.8, 0.8, 0.5, 0.5, 0.8, 1.3, 0.4, 0.8, 0.3, 0, 0,
0, 0, 6, 6, 4, 4.5, 4, 4, 2, 1.5, 1, 0.8, 0.8, 0.8, 0.8,
0.8, 1.5, 0.4, 0.3, 0.4, 0.3, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
0, 0, 2, 0, 0, 0, 0, 0, 2, 2, 0, 2, 0, 2, 2, 2, 0, 0, 0,
0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 20, 95, 125,
150, 205, 155, 100, 85, 32, 23, 17, 14, 16, 12, 29, 205,
470, 266, 204, 170, 200, 205, 100, 110, 130, 95, 110, 155,
300, 325, 236.2, 214, 192.5, 150, 161.2, 154.8, 143.5, 134.8,
144.9, 151.4, 172.6, 158.9, 131.6, 146.5, 127.6, 122.5, 169.8,
116, 106.7, 103, 106, 101.2, 78.1, 34, 28, 24, 19, 16, 15,
16, 70, 65, 38, 27.61, 26.9, 33.86, 70.51, 102.1, 88.38,
102.5, 99.18, 117.1, 135, 150.1, 250.3, 209.5, 163.1, 211.1,
203.1, 192.7, 179.9, 164.6, 145, 129, 162, 130.2, 131.5,
125, 109.6, 110, 100.3, 93.37, 79.81, 31.07, 16.31, 15.64,
15, 13.37, 12.29, 10.03, 8.826, 8.168, 7.148, 7, 6.017, 5.334,
4.768, 11.19, 9.315, 9, 8, 14, 14, 16, 16, 14, 9, 9, 8, 8,
9, 9, 8, 8, 7, 7, 6, 7, 6, 5, 9, 9, 8, 8, 8, 7, 8, 8, 9,
7, 5, 5, 4, 4, 3, 3, 3, 3, 3, 2.5, 2.5, 2.5, 2.5, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA)), class = "data.frame", row.names = c(NA,
-1310L))
问题源于这样一个事实,即 sum
长度为零的向量给你零而不是 NA
。
> sum(vector("numeric",0))
[1] 0
在这种情况下,一个简单的解决方案是将您自己的 sum
版本升级为 return NA
:
mysum <- function(x) if(length(x)==0) return(NA) else return(sum(x))
然后:
head(apply.monthly(Rain, FUN=mysum), 20)
[,1]
1991-06-30 NA
1991-07-31 NA
1991-08-31 NA
1991-09-30 NA
1991-10-31 NA
1991-11-30 NA
1991-12-31 NA
1992-01-31 136.003
1992-02-29 143.441
1992-03-31 119.099
1992-04-30 160.499
1992-05-31 267.466
1992-06-30 247.796
1992-07-31 2945.751
1992-08-31 2654.740
1992-09-30 1035.112
1992-10-31 279.582
1992-11-30 6.320
1992-12-31 0.000
1993-01-31 0.000