这是示例数据:
a <- structure(list(Occ = c(1, 2, 3, 4, 4, 5, 6, 4, 8, 5),
Type = c("A", "B", "C", "A", "A", "A", "B", "C", "C", "B"),
Alc = c("A", "B", "N", "A", "N", "N", "N", "A", "B", "B"),
Count = c(10, 10, 20, 10, 15, 15, 10, 10, 20, 15)),
.Names = c("Occ", "Type", "Alc", "Count"), row.names = c(NA, -10L), class = "data.frame")
我喜欢获取列的每个属性的频率计数,如下所示:
Occ: Type Alc Count
1: 1 A: 4 A: 3 10: 5
2: 1 B: 3 B: 3 15: 3
3: 1 C: 3 N: 4 20: 2
4: 3
5: 2
6: 1
8: 1
这个问题可以通过 'anacor' 包中的 'summary' 函数部分解决。我仍在寻找更好的解决方案。