搜索了幾個小時之後,它發現我無法找到解決以下問題的解決方案。我有2個數據幀,一個包含觀察日期的一列,其他包含開始日期和日期和結束日期:R從一個單獨的數據框中查詢日期在一個數據框中的日期
例如:
head(x)
station temp obsdate
311820 65.0 1973-01-01
311821 62.0 1973-01-02
etc...
head(seasonDates)
season startDate endDate
A 1973-11-01 1974-06-30
B 1974-11-01 1975-06-30
C 1975-11-01 1976-06-30
etc...
我想分配「季節'如果觀察日期'obsdate'在由'startDate'到'endDate'指示的日期範圍內,則從'seasonDates'數據框到'x'數據框。任何幫助是極大的讚賞。
[你嘗試過什麼?](http://whathaveyoutried.com) – 2013-02-07 21:59:32
我希望我可以使用條件來解決這個: 'ifelse(x $ obsdate> = seasonDates $ startDate,x $ season = seasonDates $ season,0)' – austin