# VFREQUENCY function

## Description

VFREQUENCY(bins,variable[,filter]) returns a frequency table of the variable as a matrix. variable. An optional filter can be specified.

The argument bins must be a one-dimensional matrix<.

The number of elements in the returned matrix is one more than the number of elements in bins matrix. The extra element in the returned matrix returns the count of any values above the highest value in the bins matrix.

## Example

When the variable bmi contains the values 18, 22, 23, 25, 28, 29, 31, then VFREQUENCY({20,25,30},bmi) returns the matrix {1,3,2,1}, because

- 1 bmi value is less than or equal to 20
- 3 values are more than 20 and less than or equal to 25
- 2 values are more than 25 and less than or equal to 30
- 1 value is more than 30

Note that the numbers in the bins matrix have to be sorted by magnitude, but the data do not have to be sorted.

## Note

This function calculates a statistic on a variable. Be careful when you use this function in cells of the columns that correspond to the variable, because this actually adds a value to the variable which can lead to unexpected and faulty results. You can exclude the cell to avoid this.