-1
我有这个数据库:R:计数的一个因素的累积长度data.frame
Time = c("2016-03-01","2016-03-02","2016-03-03","2016-03-02","2016-03-03","2016-03-02")
match = c("a","b","c","a","b","c")
names = c("julien","julien","julien", "mathieu","mathieu","simon")
df = data.frame(Time, names, match)
df = df[order(Time),]
df
Time names match
1 2016-03-01 julien a
2 2016-03-02 julien b
4 2016-03-02 mathieu a
6 2016-03-02 simon c
3 2016-03-03 julien c
5 2016-03-03 mathieu b
而且我想通过时间由每个玩家扮演一个新列匹配的累计数。我想知道,在任何时候,每个球员打了多少比赛。像这样:
Time names match nb.of.match.played
1 2016-03-01 julien a 1
2 2016-03-02 julien b 2
4 2016-03-02 mathieu a 1
6 2016-03-02 simon c 1
3 2016-03-03 julien c 3
5 2016-03-03 mathieu b 2
这似乎很容易做到,但我尝试了一次失败的结果的事情每次。 感谢您的帮助!
显示一些尽可能地和它 – IceFire
对不起,我没有任何有形的铅(代码段)值得炫耀的,我们可以看看你的工作代码段的....我想这解决方案:http://stackoverflow.com/questions/22843286/r-cumulative-count-over-multiple-columns-by-factor但我不认为目标是相似的。 –