如何从时间戳创建水年?

时间:2015-02-10 23:31:46

标签: r

我有这个数据帧多年。我使用以下代码从时间戳中提取年份:

library('tidyr')
dat<-separate(dat, "peak_dt", into = c("year", "month", "day"), sep = "-")

然而,这给了我一年而不是水年。水年是从10月1日到9月30日。因此,截至1999年9月30日的年份被称为&#34; 1999&#34;水年和1999年10月3日将是2000水年?

我怎样才能编写一个能给我一年而不是一年的功能。

1925-01-28
1926-02-06
1927-01-31
1927-11-25
1928-11-09
1930-02-07
1931-03-31
1932-01-18
1933-01-02
1933-12-06
1934-11-07
1936-01-04
1937-04-14
1937-12-27
1938-12-15
1940-02-06
1941-01-18
1941-12-19
1942-11-23
1943-10-24
1945-02-07
1945-12-28
1946-12-15
1948-02-22
1949-02-17

P.S。这个问题有一个功能,但我无法根据我的代码进行调整:R Create function to add water year column

0 个答案:

没有答案
相关问题