Enter a Formula for an Attribute |
How To... > Work with Formulas > Enter a Formula for an Attribute Briefly, click on an attribute name in a case table and choose Edit | Edit Formula to open the formula editor. Enter the formula for the attribute there. To calculate the values of an attribute from the values of other attributes, write a formula telling Fathom how to do the calculation. For example, if your student data has height expressed as two attributes, feet and inches, you might write a formula for heightInInches, which would be 12 * feet + inches. If you had time and distance, you might make speed. You write the formula in the formula editor. A formula is not a complete equation; it is an expression for computing the value of an attribute. We’ll use the example in which we define speed to be distance/time.
Alternatively, you can bring up the context menu (see Context (Right-Click) Menus) for the attribute (as shown here) and choose Edit Formula. Or double-click in the formula box for the attribute. These two methods work just as well in the collection inspector (see Cases Panel).
Some attributes may require formulas with conditional functions such as if-statements. See Express a Condition with an If-Statement and Recode with a Switch Statement. Note: You can use the same context menu that gives you Edit Formula to use Cut, Copy, Paste, and Clear with formulas. These commands are perfect for removing formulas from attributes (while preserving their values) and for giving the same formula to many attributes. Other uses of formulas: Writing formulas for statistics (see Define a Measure) in a collection, or computing things in summary tables, (see Add or Remove a Summary Table’s Formulas). Writing filters. See Write a Filter. |