| Author |
Comment/Response |
yehuda
|
02/25/13 11:37pm
It is more than a simple Case or Select (since then you will have to loop according to the values of the first element)
1. Transpose a (Thread also works) so you get a list of pairs, one from the first list and one form the second list
2. GroupBy to group these pairs according to their first element
3. Use Map at level 2 to remove the first element
4 Map the function Mean on the result so you get your results
Mean /@ Map[Last, GatherBy[Transpose[a], First], {2}]
result is {3,4} as expected
HTH
yehuda
URL: , |
|