Re: eliminate values while caculating Mean[data]

*To*: mathgroup at smc.vnet.net*Subject*: [mg91958] Re: eliminate values while caculating Mean[data]*From*: Bill Rowe <readnews at sbcglobal.net>*Date*: Mon, 15 Sep 2008 03:40:11 -0400 (EDT)

On 9/13/08 at 5:57 AM, karami at geo.uu.nl (Pasha Karami) wrote: >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? Use DeleteCases to omit the unwanted values, i.e., In[2]:= Mean@DeleteCases[data, 0] Out[2]= 3