I have a dataset where each item is of the form:
<|"p1" -> x1, "p2" -> x2, "r1" -> y1, "r2" -> y2|>
The interpretation is this:
p2 are parameters, which can take on different values (in this case represented by
r2 are the results of some simulation carried out with some specific values for the parameters
p2. For this particular item, the simulation was run with
p2=x2, and the results were
r2=y2. Now, given fixed values of the parameters
p2, there can be some variation in the results
r2. So my dataset, which is a
List of items of the form above, has many repetitions for each particular pair of parameter values. Now what I want to do is transform this list, into another list, where the items are again of the form:
<|"p1" -> x1, "p2" -> x2, "r1" -> m1, "r2" -> m2|>
m1 is the mean of
y1 for all simulations with parameter values
p2=x2, and similarly for
m2. So the new list has no repetitions: there is only one entry per pair of parameter values.
What's the simplest way of doing this?
My Mathematica version is 10.3.