top_n versus order in r

后端 未结 2 999
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-18 21:47

I am having trouble understanding the output from dplyr\'s top_n function. Can anybody help?

n=10

df = data.frame(ref=sample(letters,n),score=rnorm(n))

req         


        
2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-18 22:24

    My misunderstanding and expectation was due to my reading of the documentation linked to in the question and described in the comments. Despite some documentation claims, top_n does not generated output ordered by wt.

提交回复
热议问题