...
Column reference example:
d-codelang-syntax |
---|
RawWrangle | true |
---|
Type | ref |
---|
showNote | true |
---|
WrangleText | derive type:single value: |
---|
| ABSabs(MyInteger) as:'abs_MyInteger' |
|
abs(MyInteger) |
Output: Generates the new abs_MyInteger
column containing the Returns the absolute value of each value found in the MyInteger
column.
Numeric literal example:
d-code-lang-syntax |
---|
RawWrangle | true |
---|
Type | ref |
---|
showNote | true |
---|
WrangleText | delete row:( |
---|
| ABS |
(abs(MyInteger) == 5) |
Output: Deletes all rows from the dataset in which the Returns true
if the absolute value of the entry in the MyInteger
column is 5.
d-code-lang-syntax |
---|
RawWrangle | true |
---|
Type | syntax |
---|
showNote | true |
---|
WrangleText | derive type:single value: |
---|
| ABS |
abs(numeric_value) |
Argument | Required? | Data Type | Description |
---|
numeric_value | Y | string, decimal, or integer | Name of column or Decimal or Integer literal to apply to the function |
...
You can use the following transform to derive the absolute values of these columns, which now measure distance from the fixed point:
...
trans |
---|
RawWrangle | true |
---|
p03Value | 'distanceX' |
---|
Type | step |
---|
WrangleText | derive type:single value: |
---|
|
...
...
p01Name | Formula type |
---|
p01Value | Single row formula |
---|
p02Name | Formula |
---|
p02Value | abs(X) |
---|
p03Name | New column name |
---|
SearchTerm | New formula |
---|
|
D trans |
---|
RawWrangle | true |
---|
p03Value | 'distanceY' |
---|
Type | step |
---|
WrangleText | derive type:single value: |
---|
|
...
abs(Y) as: 'distanceY' | p01Name | Formula type |
---|
p01Value | Single row formula |
---|
p02Name | Formula |
---|
p02Value | abs(y) |
---|
p03Name | New column name |
---|
SearchTerm | New formula |
---|
|
Results:
X | Y | distanceX | distanceY |
---|
-2 | 4 | 2 | 4 |
-6.2 | -2 | 6.2 | 2 |
0 | -4.2 | 0 | 4.2 |
4 | 4 | 4 | 4 |
15 | -0.05 | 15 | 0.05 |
...