代码之家  ›  专栏  ›  技术社区  ›  Tariq335

统计R中前10位最常出现的作者的最佳方法

  •  1
  • Tariq335  · 技术社区  · 6 年前

    这是我的密码

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

    1 回复  |  直到 6 年前
        1
  •  0
  •   akrun    6 年前

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

    head(sort(table(author), decreasing = TRUE), 10)
    
    推荐文章