Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dat = {{2, .1, .2}, {2, .2, .4}, {2, .3, .6}, {2, .4, .8}, {5, 1,
- 2}, {5, 2, 4}, {7, 20, 10}, {7, 40, 20}, {7, 60, 30}, {7, 80,
- 40}, {7, 100, 50}, {10, 30, 50}};
- results = Table[N[Mean[Select[dat, #[[1]] == i &]]], {i, {2, 5, 7, 10}}];
- Mean /@ GatherBy[dat, First]
- Mean /@ GroupBy[dat, First]
- MaximalBy[#, #[[2]] &] & /@ GatherBy[dat, First]
- MaximalBy[#, #[[2]] &] & /@ GroupBy[dat, First]
- Values @ GroupBy[dat, First, Mean]
- Values @ Merge[Mean][Rule[#, {##}]& @@@ dat]
Add Comment
Please, Sign In to add comment