slice-min
Keep the n rows with the smallest value of col.
NoteExperimental
This function is experimental; its interface may change without notice.
Since 0.6.0.
The bottom-n counterpart of slice-max, with the same parsing, grouping, and no-tie-expansion rules (non-numeric or missing col sorts last).
Usage
slice-min(
data,
col,
n: 1,
by: none,
)Parameters
| Parameter | Default | Description |
|---|---|---|
data |
Row-store (array of dicts) or column-store (dict of arrays). | |
col |
Column to rank by. | |
n |
1 |
Number of rows to keep per group. |
by |
none |
Grouping columns: none, a column name, or an array of names. |
Returns
A row-store array of the bottom rows.
Examples
The most economical car in each class.
#let best = slice-min(mpg, "hwy", by: "class")