head function
The head function returns in each row the first n letters of the corresponding value in the column.
Parameters
head(column, nchar)
If you are using continuous attributes, check the Flow Execution Parameters.
Parameter | Description |
---|---|
column | The nominal attribute containing the strings. If the column is not nominal, it will be casted to nominal upon function’s computation. The column parameter is mandatory. |
nchar | The number of letters we want to select for each string in the column. It can be either a specified value or an integer attribute. The nchar parameter is mandatory. |
Example
The following example uses the Adult dataset.
Description | Screenshot |
---|---|
In this example, we want to transform the Sex attribute values into their initial. Add a new attribute, called newvalues, and write the following formula:
The function has returned the first letter of each value in the corresponding row. |