Project Transform

The project transform performs a relational algebra projection operation. In Vega, this results in a new stream of derived data objects that include one or more fields of the source stream. This operator supports optionally renaming the copied data fields. This operator should be not be confused with cartographic projections.

Transform Parameters

Property Type Description
fields Field[ ] The data fields that should be copied over in the projection. If unspecified, all fields will be copied using their existing names.
as String[ ] For each corresponding field in the fields array, indicates the output field name to use for derived data objects.

Usage

{"type": "project", "fields": ["foo", "bar"]}

Generates a stream of derived data objects containing only the fields "foo" and "bar".

{"type": "project", "fields": ["foo", "bar"], "as": ["a", "b"]}

Generates a stream of derived data objects with fields "a" and "b" containing the values of the source fields "foo" and "bar", respectively.