嗨,我是R的新手,我在下面遇到了这个问题。
Name ClassType SessionAttended
David Swimming 5
David Basketball 4
Raymond Swimming 7
Raymond Basketball 3
George Swimming 2
George Basketball 5
我想创建两个新的列SwimmingAttended和BasketballAttended,以计算每个班级的出席次数,这样看起来
Name SwimmingAttended BasketballAttended
David 5 4
Raymond 7 3
George 2 5
我知道这很容易,但是我正在努力。任何人都可以提供任何想法吗?谢谢。