【发布时间】:2017-02-02 04:01:13
【问题描述】:
Year tot_precip
1/1/1989 0
1/2/1989 .23
1/3/1989 0
1/4/1989 .43
1/5/1989 0.254
1/6/1989 0
1/7/1989 0
1/8/1989 0
1/9/1989 0
1/10/1989 .21
我正在尝试根据某些月份对我的降水数据进行子集化。我做了一些研究。
tt=as.POSIXct(paste(prec$Year,prec$tot_precip), format="%m/%d/%Y")
datZoo <- zoo(prec[,-c(1,2)], tt)
month <- function (x) as.numeric(format(x, "%m"))
veranoIdx <- which(month(tt) %in% 6:8)
veranoZoo <- datZoo[veranoIdx]
veranoZoo
上面的代码可以根据某些月份(6 月、7 月 8 月)提取年份列,但我不知道如何提取这些日期的降水值(即 veranoZoo 系列)
【问题讨论】:
标签: r