我有一个带有字符串值列的大型数据框(约 600K 行)(链接)
doc_id,link
1,http://example.com
1,http://example.com
2,http://test1.net
2,http://test2.net
2,http://test5.net
3,http://test1.net
3,http://example.com
4,http://test5.net
我想计算某个字符串值在帧中出现的次数。结果应如下所示:
link, count
http://example.com, 3
http://test1.net, 2
http://test2.net, 1
http://test5.net, 2
在 R 中有没有一种有效的方法来做到这一点?由于帧大小,将帧转换为矩阵不起作用。目前我正在使用 plyr 包,但这太慢了。