Using the Map function to create new values

The Map function is divided into categories of functions that create new values to help you derive meaning from your dataset. The new values can be based on one or multiple selected columns. For example, you can perform an arithmetic calculation from values in two selected columns to create a third column that contains the results of the calculation. The new value may also be generated without any input. For example, you can generate a column of unique, random values.

This section describes the steps for performing a Map function. For descriptions of all Map functions, see Map functions.

IMPORTANT: Many Map functions work in a similar way as Microsoft Excel functions. However, there might be differences, such as differences in the number of operands accepted. Do not assume that the Map functions are identical to the Excel functions even though they share the same name.

How a Map function works on Mixed, Array, or Object columns

If you use a Mixed column as input to a Map function, the function is run on the cells of a data type appropriate for the function. For all other cells, the function returns FNF. For example, if a Mixed column is the input for the div function, the division is performed only on numerical cells. FNF is displayed for each non-numerical cell in the resultant column.

If you use an Array or Object column as input to a Map function, the input value is treated as FNF.

For more information about FNF, see Working with a table containing FNF.

NOTE: You cannot start a Map function from the column drop-down menu of an Array or Object column, but you can run the function from the function bar using a column of any type as input. For more information about using the function bar, see Using the function bar.

Creating a column

Follow these steps to create a column with the Map operation:

  1. Right click the header of the column from which you want to create new values. In the drop-down menu, select Map…. The MAP panel is displayed.

    Boolean values are case-insensitive. For example, in an input field that accepts a Boolean value, you can type true, True, false, or False.

  2. In the MAP panel, follow these steps to select the function:

    1. Select the category. The functions in the selected category are displayed.
    2. Select the function.

      TIP: You can quickly locate a function by typing its name or part of a its name in the Search map functions... field. Functions with a matching name are displayed in the Category and Function columns.
    3. Accept the default name for the new column or enter a new name.

  3. Based on the description of the function, fill out the operand fields.
  4. Accept the default name for the new column or enter a new name.
  5. (Optional) Select Include only erroneous rows if you want to filter the resultant table such that only erroneous rows are included. For more information about erroneous rows, see Creating a table with only erroneous rows.
  6. Click MAP.

Example of using the type-casting function

After you select the Map… option in the column drop-down menu, the MAP panel is displayed.

Follow these steps to create a column with the desired data type:

  1. In the Table field, if the desired table name is not already displayed, click the down arrow to display a list of tables and then select the desired table.
  2. In the Category field, select type-casting.
  3. In the Function field, select the desired data type.
  4. The first argument (x) is the active column name by default. You can accept the default or enter the name for another column whose data type will be changed.

    If the desired data type is integer, enter the base as the second argument. For example, for base 10, type 10; for binary, type 2.

  5. Type a column name in the New Resultant Column Name field.
  6. If you are interested only in the rows where the Map function fails, select Include only erroneous rows. For example, if you want to know if there are values in a particular column that cannot be type cast into Integer, select this option. The resultant table will contain only rows with data in this column that cannot be changed by the Map function.
  7. Click Map. A new column is created with the new data type.

    NOTE: If you did not enter the second argument, an error message is displayed, requiring you to click the No Argument check box. After you click the check box, click Map.

The following sample Map panel illustrates how you can change the data type to integer.

Using Map on an unpopulated column

After you add a blank column to your table, the column contains no values and the column's data type is Unknown. You can initiate a Map function from such a column. However, not all functions displayed in the MAP panel accepts an operand whose type is Unknown. The following partial screenshot shows an example of a newly added column containing no values.

Result of Map initiated from an unpopulated column

Typically a Map function creates a new column containing values based on the input column. But if you run a Map function from an unpopulated column, the resultant column replaces the unpopulated column.

For example, from the unpopulated column, you can start the MAP panel to create a column of a particular data type, as illustrated in the following screenshot:

After the function is finished, the table contains a new column, as illustrated in the following screenshot:

Go to top