Mean Value (Arithmetic Average)

DESCRIPTION:
Returns a number which is the mean of the data. A fraction to be trimmed from each end of the ordered data can be specified.

USAGE:
mean(x, trim = 0, na.rm = F)

REQUIRED ARGUMENTS:
x:
numeric object.
Missing values (NA) are allowed.

OPTIONAL ARGUMENTS:
trim:
fraction (between 0 and .5, inclusive) of values to be trimmed from each end of the ordered data. If trim=.5, the result is the median.
na.rm:
logical flag: should missing values be removed before computation?

VALUE:
(trimmed) mean of x.

DETAILS:
If x contains any NAs, the result will be NA unless na.rm=TRUE. If trim is nonzero, the computation is performed to single precision accuracy.

When trim is positive, approximately trim*length(x) largest values and trim*length(x) smallest values are ignored; the mean of the remaining values is returned. When trim=.25, the result is often called the "midmean".


REFERENCES:
Hoaglin, D. C., Mosteller, F. and Tukey, J. W., editors (1983). Understanding Robust and Exploratory Data Analysis. Wiley, New York.

SEE ALSO:
apply , median , robloc , testscores , var .

EXAMPLES:
algebra <- testscores[,3] # vector of 25 algebra testscores
mean(algebra)   # Computes the average (in double precision)
mean(algebra, trim = .1) # Computes the 10% trimmed mean of scores

apply(testscores, 2, mean) # vector of the means of the columns of scores