Re: Simple mean question.

Douglas Bates (
21 Jan 1998 09:15:50 -0600

"Rubin, Caleb" <> writes:

> I need to calculate the mean of a variable for a subset of the data.
> It does not seem that the mean functions allows the "subset=" option.

> Does anyone know how I might accomplish this.

You can put the subsetting expression within the call to mean as in
mean( x[ x > 5 ] )