Re: eliminate values while caculating Mean[data]

*To*: mathgroup at smc.vnet.net*Subject*: [mg91960] Re: [mg91946] eliminate values while caculating Mean[data]*From*: "Thomas Dowling" <thomasgdowling at gmail.com>*Date*: Mon, 15 Sep 2008 03:40:33 -0400 (EDT)*References*: <200809130957.FAA03553@smc.vnet.net>

Hello, There are probably many strategies. Just a few worth considering ... Mean[Cases[data, Except[0]]] or Mean[Cases[data, x_ /; 1 <= x, Infinity]] or Mean[DeleteCases[data, 0]] or, using Select, Mean@Select[data,#>0&] Tom Dowling On Sat, Sep 13, 2008 at 10:57 AM, Pasha Karami <karami at geo.uu.nl> wrote: > Dear all, > > An easy question: > I would like to make an average of a data file.I know that we can use > Mean function for this. > > However, I want to eliminate some values from my data.For example if I > have > > data={1,2,3,4,5,0,0,0} > Mean[data] would be 15/8 > > I do not want the "zero" values in my Mean function (i.e.I want the mean > value to be 3 in the above example) How can I do this? > > Thank you! > Best, > Pasha > > >

**References**:**eliminate values while caculating Mean[data]***From:*"Pasha Karami" <karami@geo.uu.nl>