【问题标题】:Best way to count the top 10 most frequent authors in R计算 R 中最常见的 10 位作者的最佳方法
【发布时间】:2020-03-03 12:42:57
【问题描述】:

这是我的代码

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 函数?谢谢

【问题讨论】:

  • 排序(表(作者,递减=T))[1:10]

标签: html r html-table rstudio


【解决方案1】:

我们可以sort 得到前10个元素head

head(sort(table(author), decreasing = TRUE), 10)

【讨论】:

    猜你喜欢
    • 2010-10-25
    • 1970-01-01
    • 2015-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-14
    相关资源
    最近更新 更多