select

Keep only the named columns, in the given order.

NoteExperimental

This function is experimental; its interface may change without notice.

Since 0.6.0.

Positional string columns select and reorder; other columns are dropped. A selected as-factor column keeps its discrete tag.

Usage

select(
  data,
  ..names,
)

Parameters

Parameter Default Description
data Row-store (array of dicts) or column-store (dict of arrays).
..names Columns to keep, as positional strings.

Returns

A row-store array carrying only the named columns.

Examples

Keep just the class and highway columns.

#let trimmed = select(mpg, "class", "hwy")

See also

rename, relocate.

Back to top