Why is query optimization important?

R (programming language): What new happen in the field of top-k query processing and optimization in relational database system

  • Answer:

    I would do: head(df[order(df$col, decreasing=T), ], k)

Michael Hochster at Quora Visit the source

Was this solution helpful to you?

Other answers

1. Base R df[with(df, order(col, decreasing=T)), ][1:k, ] 2. Using plyr arrange(df, -col)[1:k,] 3. Using sqldf sqldf("SELECT * FROM df ORDER BY col DESC LIMIT k")

Jeff Hammerbacher

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.