Shape · Columns
Bin
Turns a number into a labelled band, using your own break points or equal-width buckets. For example, ages into 0–17, 18–64 and 65+.
Also known as: Bucket, tile, age groups
How it works
Pick the numeric Column and a Mode. In Edges mode click Add edge for each break point, in ascending order, and optionally give one label per band under Labels (optional). In Equal width mode set Low, High and a Bin count. Boundary decides which side a value equal to an edge falls on: Left [lo, hi) puts it in the upper band, Right (lo, hi] in the lower one. N edges give N + 1 bands; the first and last are open-ended, and without labels they are named from the edges, such as < 18, [18, 65) and >= 65. The band goes to Output column, by default <column>_bin, and a null value gives a null band.
Inputs and outputs
Inputs
data— Table
Outputs
data— Table
Settings
The Attributes panel of Bin, as in the app: the controls work, but nothing runs — there is no data behind it.
The same settings, as the Assistant writes them
{
column: string
mode: "edges" | "width"
edges?: number[]
labels?: string[]
low?
high?
count?
closed?: "left"|"right"
outputColumn?: string
}
Example
You want age groups for a survey. Choose age, Edges mode with edges 18 and 65, labels Under 18, 18 to 64 and 65+, and keep Left [lo, hi) so that 18 and 65 start their bands.
| age | age_bin |
|---|---|
| 17 | Under 18 |
| 18 | 18 to 64 |
| 65 | 65+ |
| NULL | NULL |