0
$\begingroup$

i have the following question: Let us assume we have the following list:

list={1.1,1.2,1.0,2.1,2.2,2,0,3.1,3.0,3.2}

I need a function that always takes three values of this list and put the Mean of these three values into a new list so I want to end with:

list2={1.1,2.1,3.1}

How can i do this easily?

Thank you in advance

Edit: Thank you very much

$\endgroup$
  • 1
    $\begingroup$ If you've received a satisfactory answer to your question, you don't have to edit your post to say thank you, you should accept the answer instead. $\endgroup$ – Rahul May 30 '14 at 8:42
  • 1
    $\begingroup$ And you should upvote any answer you like, too. $\endgroup$ – Yves Klett May 30 '14 at 8:45
  • 1
    $\begingroup$ I changed the marked duplicate to one that truly is a duplicate. Please also see the questions linked in my answer there. $\endgroup$ – Mr.Wizard May 30 '14 at 9:30
3
$\begingroup$
Mean/@Partition[list,3]

This partitions the list into a list of lists with three elements each, and then finds the mean of each list and stores the results in a list. This will only work for lists of length 3, 6, etc.

In the example you've given, there's a stray $0$ which I think you may have missed.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.