# 3.5.2.1 ave

## Description:

The ave function breaks dataset into groups of size size, finds the average for each group, and returns a range containing these values.

## Syntax:

dataset ave(dataset vd, int size[, int stats])

## Parameters:

vd

A dataset, or a range pointing to a single dataset.

size

An integer for the number of elements in each group. If the dataset size is not an even multiple of group size, then the final average will represent only mod(DatasetSize,GroupSize) elements.

stats

1 (default): mean, 2: sd, 3: se, 4: min, 5: max, 6: median, 7: sum, 8: RMS

## Return:

Returns a dataset.

## Examples:

//group every 5 points in column A and return average of each group to column B
col(B) = ave(col(A),5);
//return the maximum by week
col("Weekly") = ave(col("Days"),7,5);

//group every 100 points in 2nd column and return SD of each group to 3rd column
col(2) = int(65 + 35 * uniform(5000));
col(3) = ave(col(2),100,2);