我有一個數據框,它有4000多列和3000行。列是公司和行有每日股票收盤價格。這些行具有基於月份日期的每日觀察數據。現在,我想要刪除每個月的最後一個日期之間的行,即我想根據月份的最後一天的數據形成我的數據框。每個月的最後日期應根據我的數據框中的日期列可用。 我的問題對他人的主要挑戰和差異是上個月的日期應該根據我的數據框中提供的日期。它的財務數據和非交易日,沒有。的交易日不同於其他類型的行業 我舉例說明了我的數據框的一部分。根據R中的日期刪除數據幀的行
Date A B
30/12/1999 1 3
04/01/2000 1 3
05/01/2000 1 3
06/01/2000 1 3
07/01/2000 1 3
10/01/2000 1 3
11/01/2000 1 3
12/01/2000 1 3
13/01/2000 1 3
14/01/2000 1 3
17/01/2000 1 3
18/01/2000 1 3
19/01/2000 1 3
20/01/2000 1 3
21/01/2000 1 3
24/01/2000 1 3
25/01/2000 1 3
26/01/2000 1 3
27/01/2000 1 3
28/01/2000 1 3
31/01/2000 1 3
01/02/2000 1 3
02/02/2000 1 3
03/02/2000 1 3
04/02/2000 1 3
07/02/2000 1 3
08/02/2000 1 3
09/02/2000 1 3
10/02/2000 1 3
11/02/2000 1 3
14/02/2000 1 3
15/02/2000 1 3
16/02/2000 1 3
17/02/2000 1 3
18/02/2000 1 3
21/02/2000 1 3
22/02/2000 1 3
23/02/2000 1 3
24/02/2000 1 3
25/02/2000 1 3
28/02/2000 1 3
29/02/2000 1 3
所需的輸出
Date A B
30/12/1999 1 3
31/01/2000 1 3
29/02/2000 1 3
我會很感激你在這方面的幫助。
我們必須假設您在提問前徹底搜索過。請詳細說明爲什麼[**這些答案**](http://stackoverflow.com/search?tab=votes&q=%20%5br%5d%20last%20day%20month)沒有幫助。 「這個問題沒有顯示任何研究工作」,但只是plz發送codez。 – Henrik
@Henrik我的問題對他人的主要挑戰和差異是上個月的日期應該根據我的數據框中提供的日期。它的財務數據和非交易日,沒有。的交易日與其他類型的行業不同。 – Aquarius
@Aquarius看看'lubridate'和'zoo'包裝。 – Sotos