suffix function in the Factory

The suffix function considers the chosen value as suffix and returns the preceding characters.


Parameters

suffix(column, value, last)

If you are using continuous attributes, check the Flow Execution Parameters.

Parameter

Description

column

The nominal attribute containing the strings. If it is not nominal, it will be casted to nominal upon function’s computation. The column parameter is mandatory.

value

The substring value to be searched into the strings of the column. The value parameter is mandatory.

The value parameter is case sensitive.

last

If False, or not specified, the function selects the first occurrence of the value within the string, while if it is True, the function selects the last occurrence of the value which has to be considered.


Example

The following example uses the Adult dataset.

Description

Screenshot

In this example, we want to retrieve as suffixes the characters after the i in the marital-status attribute.

Add a new attribute, which we have called suffix, and type the following formula:

suffix($"marital-status",'i')

As we didn’t specify the last parameter, the function considers as suffix all the characters after the first value (i in this example) occurrence.