Work with the Formula Editor

Top  Previous  Next

How To... > Work with Formulas > Work with the Formula Editor

Formulas are used throughout Fathom for a variety of purposes. Any time you create or edit a formula, you use the same formula editor interface. You can use formulas to do the following:

 

Use a formula to …

Example

Determine the values of a new attribute.

Define an attribute, PopulationDensity, and give it the formula Population/Area or one of the Random Functions.

Define a filter.

Enter the formula sex = "M" to look at only the males in a collection of people. (see Write a Filter.)

Summarize data.

To summarize student heights, enter the formulas mean(height), median(height), and (max(height)+min(height))/2. See Add or Remove a Summary Table’s Formulas or Define a Measure.

Define a statistic.

To compare tomato plants grown in sunny locations with those grown in shady locations, enter this formula: (mean(height, loc = "sunny")–mean(height, loc = "shady").

Control a simulation.

Suppose you wanted to throw dice until there were 2 sixes. You would use an “until” command in the Collect Measures panel of a measures collection inspector with the formula count(face=6)=2.

Compute a slider value.

To make a slider that will choose a random integer between 1 and 100 each time its animation button is pressed, give it the formula randomInteger(1, 100).

 

With formulas, you don’t simply choose from a list of statistics or filters or simple computations. You can compute practically anything you want, as long as you know how to express it.

See Fathom Operators, Functions, and Units for a complete list of the functions available in Fathom.

Subsections

Open the Formula Editor

Color-Coding in Formulas

Use the Keypad

Use the Attribute and Function List

Make Exponents

Express a Condition with an If-Statement

Recode with a Switch Statement

Move the Cursor and Select a Portion of an Expression

Frequently Asked Questions About Formulas