The MEAN function computes the mean of a numeric vector. MEAN calls the IDL function MOMENT.

## Examples

; Define the n-element vector of sample data:

x = [65, 63, 67, 64, 68, 62, 70, 66, 68, 67, 69, 71, 66, 65, 70]

; Compute the average:

result = MEAN(x)

; Print the result:

PRINT, result

IDL prints:

66.7333

## Syntax

*Result* = MEAN( *X *
[, DIMENSION=*value*]
[, /DOUBLE] [, /NAN] )

## Return Value

Returns the average value of a set of numbers.

## Arguments

### X

An *n*-element, integer, double-precision or floating-point vector.

## Keywords

### DIMENSION

Set this keyword to a scalar indicating the dimension across which to calculate the mean. If this keyword is not present or is zero, then the mean is computed across all dimensions of the input array. If this keyword is present, then the mean is only calculated across a single dimension. In this case the result is an array with one less dimension than the input.

### DOUBLE

If this keyword is set, computations are done in double precision arithmetic.

### NAN

Set this keyword to cause the routine to check for occurrences of the IEEE floating-point values *NaN* or *Infinity* in the input data. Elements with the value *NaN* or *Infinity* are treated as missing data.

## Version History

5.1 |
Introduced |

8.0 |
Added DIMENSION keyword |