我有一個數據框有2列:'銷售'和'月'。我想添加一個在每個月內對銷售進行排名的列。有誰知道最簡單的方法是什麼?我在考慮'tapply',但它給了我一個列表,我不能將它添加回數據框(簡單或簡潔)。添加tapply到一列
Sales Month Rank
100 1 3
200 2 1
300 3 1
150 1 2
220 1 1
100 is third place amongst sales that belong to month 1 while 220 is first place for month 1.
的[添加一個「等級」欄的數據幀(可能的複製http://stackoverflow.com/questions/15170777/添加排名列到數據框) – agenis