Combining Formulas and Queries in Data Manager

Formulas can be used together with queries to perform powerful operations on data.

Formulas are always computed on the data currently shown; it is therefore possible to define formulas only for a subset of the dataset.

The examples are all based on the Adult dataset.

Example

In our example we want to change all the Prof-school strings in the education attribute to Professional-school.

To quickly perform this operation:

  1. Select all the records that contain Prof-school by applying a filter.


  2. In the formula bar define education as Professional-school, delimiting the string with double quotes.


  3. Remove the filter.



    In this way only the Prof-school values have been re-defined whereas the other values are left unchanged.


Alternative operation

The same result could be obtained by using the ifelse operator, using the formula shown below: