R - TopN Analysis

> Procedural Languages > R

1 - About

3 - Package

3.1 - data.frame

  • One column
head(sort(du20150915Qas$size,decreasing=TRUE), n = 10)
  • All column
head(data.frame[order(data.frame$name, decreasing= T),], n = 10)
Advertising

3.2 - plyr

R - Dplyr (Data Frame Operations)

library(plyr)
head(arrange(data.frame,desc(name)), n = 10)

3.3 - data.table

the first two rows for each month with a R - Data Table

ans <- flights[, head(.SD, 2), by = month]