计算 R 中前 10 名最常见作者的最佳方法

Best way to count the top 10 most frequent authors in R

这是我的代码

page<-read_html("https://stat.ethz.ch/pipermail/r-help/2016-March/date.html")

author<-html_nodes(page, "li i") %>% html_text() %>% trimws()

table(author)

我得到了 table,但我正在尝试计算前十位最常出现的作者。最好的方法是什么,最好使用 table 函数?谢谢

我们可以 sort 并使用 head

获取前 10 个元素
head(sort(table(author), decreasing = TRUE), 10)