有三个变量,分别是number,year和name,想逐年统计在每个number下,不同的name分别是第几次出现。请教各位大神!谢谢!
原有的数据
number year name
001 2000 XH
001 2001 XW
001 2002 XH
002 2000 XW
002 2001 XH
002 2002 XW
希望得到的数据集
number year name times
001 2000 XH 1
001 2001 XW 1
001 2002 XH 2
002 2000 XW 1
002 2001 XH 1
002 2002 XW 2