Formula¶
The formula transform uses an expression to calculate and add a new field to the data.
Parameters¶
expr
Required- An expression string
as
Required- The (new) field where the computed value is written to
inplace
- Modify the rows in place (a temporary hack). Will be removed.
- Default:
false
Example¶
Given the following data:
x | y |
---|---|
1 | 2 |
3 | 4 |
... and configuration:
{ "type": "formula", "expr": "datum.x + datum.y", "as": "z" }
A new field is added:
x | y | z |
---|---|---|
1 | 2 | 3 |
3 | 4 | 7 |