我有一个数据框有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