Skip to main content

frequency

Returns a frequency distribution list — that is, a list of counts showing how many values from the input data fall into each defined range.

The first parameter takes a set of numbers, and the second defines a bounds list. For example, if the input list is (8, 16, 30, 42, 48) and the bounds list is (20, 30, 40), the function returns a count for these ranges:

  • values less than or equal to 20;

  • values greater than 20 but less than or equal to 30;

  • values greater than 30 but less than or equal to 40; and

  • values greater than 40.

The result in this case is the list (2, 1, 0, 2). Two numbers (8 and 16) are in the first range, one (30) is in the second range, none are in the third range, and two (42 and 48) are in the final range.

The optional third parameter controls how the function handles null/empty values.

Parameters

  • INPUT LIST (list or table region)

    A list or table region of numbers.

  • BOUNDS LIST (list)

    The bounds list for defining ranges. Must have two or more numbers. Duplicates are ignored.

  • IGNORE NULLS (Boolean)

    Optional. Whether to ignore null/empty values (true) or count as zero (false).

    Default: true

Examples

ATL in Script

Result

Notes

[[

inputList = (24, 39, 54, 72, 98, 102, 150)

boundsList = (25, 100)

frequency(inputList, boundsList)

]]

1, 4 and 2

The bounds list defines three ranges:

  1. < = 25

  2. > 25 and < = 100

  3. > 100

The result shows how many numbers from the input list fall within each range.

[[

inputList = (24, 39, 54, 72, 98, 102, 150)

boundsList = (25, 50, 100)

frequency(inputList, boundsList)

]]

1, 1, 3 and 2

The bounds list defines four ranges:

  1. < = 25

  2. > 25 and < = 50

  3. > 50 and < = 100

  4. > 100

The result shows how many numbers from the input list fall within each range.

HANDLING NULL OR EMPTY VALUES

Assume a "Describe the Table" project with this data:

 

Candidate_ID

Score

Row 1

19001

41

Row 2

19002

Row 3

19003

36

Row 4

19004

22

Row 5

19005

45

The first parameter can take a column variable, but here the Score column has an empty value. The optional third parameter tells the function to ignores null/empty values or count them as zeros. For example:

ATL in Script

Result

Notes

[[frequency(Score, (25, 50))]]

1, 3 and 0

The IGNORE NULLS parameter is unspecified, so true applies by default. The empty value in Row 2 is ignored.

[[frequency(Score, (25, 50), false)]]

2, 3 and 0

The IGNORE NULLS parameter is set to false. The empty value in Row 2 is counted as a zero, meaning it falls in the first range.

Note

In a "Describe Row in Context" project, the column variable is ScoreColumn.