## Key

• This line was removed.
• Formatting was changed.

D toc

Excerpt

Computes the positive or negative sign of a given numeric value. The value can be

...

 a Decimal or Integer literal, a function returning Decimal or Integer, or a reference to a column containing numeric values.

...

• For positive values, this function returns returns `1`.
• For negative values, this function returns returns `-1`.
• For the value value `0`, this function returns returns `0`.

D s

D s
snippet Basic

Column reference example:

SIGN
d-code-lang-syntax
RawWrangle true ref true derive type:single value:
 sign(MyInteger) as:'sign_MyInteger'

sign(MyInteger)

Output:

...

Returns the

...

sign

...

of the value found in the `MyInteger` column.

...

Numeric literal example:

(SIGN
d-codelang-syntax
RawWrangle true ref true delete row:
 (sign(MyInteger) == -1)

(sign(MyInteger) == -1)

Output:

...

Returns `true` if the sign of the entry in

...

the `MyInteger` column is `-1`.

...

D s
snippet Syntax

SIGN
d-codelang-syntax
RawWrangle true syntax true derive type:single value:
 sign(numeric_value)

sign(numeric_value)

ArgumentRequired?Data TypeDescription
numeric_valueYDecimal or Integer Decimal or Integer literal, function returning Decimal or Integer, or name of column to apply to the function

D s lang notes

### numeric_value

...

• Missing input values generate missing results.
• Literal numeric values should not be quoted. Quoted values are treated as strings.
• Multiple columns and wildcards are not supported.

...

XY
-24
-6.2-2
0-4.2
44
15-0.05

TransformTransformation:

You can use the following transform to derive the sign values of these columns:

d-

...

trans
RawWrangle true 'signX' step derive type:single value:

...

p01Name sign(X) as: 'signX' Formula type Single row formula Formula sign(X) New column name New formula

d-

...

trans
RawWrangle true 'signY' step derive type:single value:

...

p01Name sign(Y) as: 'signY' Formula type Single row formula Formula sign(Y) New column name New formula

Using these two columns, you can assign each set of coordinates into a quadrant. For ease of reading, the following has been broken into two separate tranformations:

d
-code
-trans
RawWrangle true 'lower-right' Default value case cases: [(signX == 1) && (signY == -1),'lower-right'],[(signX == 1) && (signY == 1),'upper-right']
,
p01Name default: 'line' as: 'q1' Condition type 'line' Case 01 - Value 'q1' (signX == 1) && (signY == 1) Conditional column New column name step Case 02 - Value Case on custom conditions Case 01 - Condition (signX == 1) && (signY == -1) 'upper-right' Case 02 - Condition

D trans
RawWrangle true 'lower-left' Default value case cases: [(signX == -1) && (signY == -1),'lower-left'],[(signX == -1) && (signY == 1),'upper-left'] default: 'line' as: 'q2' Condition type 'line
p03Name ' Case 01 - Value 'q2' (signX == -1) && (signY == 1) Conditional column New column name step Case 02 - Value Case on custom conditions Case 01 - Condition (signX == -1) && (signY == -1) 'upper-left' Case 02 - Condition

Then, you can merge the two columns together:

D trans
RawWrangle true 'quadrant' step merge col:q1,q2 as:'quadrant' Columns q1,q2 Separator '' New column name Merge columns

Results: