如何找到列中重复值的次数-R

时间:2012-04-23 11:39:10

标签: r statistics

  

可能重复:
  Count unique values in R

我只有一个列的名称,我需要知道每个名称在此列上的次数。

我可以做一个

summary(dfUL)

其中dfUL是我的用户列表数据框

这将给出一个关于特定值重复次数的摘要,但它只会对前6个执行此操作。如何对整个数据框执行此操作?

2 个答案:

答案 0 :(得分:7)

您是否已尝试table(dfUL)

答案 1 :(得分:1)

另一个可能有用的方法是match()函数。

match(x,dfUL$somecol) #Where x is the value in somecol you are looking for
match(max(dfUL$somecol),dfUL) #Returns the row with the maximum value of somecol