Analogous function for top_n and top_frac in dplyr, but with a different API.
top_n_dt(data, n, wt) top_frac_dt(data, n, wt)
| data | data.frame |
|---|---|
| n | If |
| wt | The numeric variable to use for ordering. |
data.table
iris %>% topn_dt(Sepal.Length,10)#> Error in topn_dt(., Sepal.Length, 10): could not find function "topn_dt"iris %>% topn_dt(Sepal.Length,-10)#> Error in topn_dt(., Sepal.Length, -10): could not find function "topn_dt"iris %>% topfrac_dt(Sepal.Length,.1)#> Error in topfrac_dt(., Sepal.Length, 0.1): could not find function "topfrac_dt"iris %>% topfrac_dt(Sepal.Length,-.1)#> Error in topfrac_dt(., Sepal.Length, -0.1): could not find function "topfrac_dt"