I have a list in the form {{a, 1}, {b, 2}, {c, 3}}.
Let's say I want to operate a transformation on all the second elements of each sublist, but this transformation is a function of them all together. As an example I want to Standardize them.
At the moment I've implemented this with Transpose.
mylist = {{a, 1}, {b, 2}, {c, 3}};
newlist = Transpose[{mylist[[All, 1]], Standardize[mylist[[All, 2]]]}]
and the output is correctly
{{a, -1}, {b, 0}, {c, 1}}
I find this a little cumbersome, this approach can become complicated and hard to read sometimes. Isn't there a more natural way?
newlist = mylist; newlist[[All, 2]] = Standardize[newlist[[All, 2]]];
, but I don't consider it any more natural than what you have. $\endgroup$ – J. M.'s ennui♦ Jun 10 '13 at 15:30MapAt[Standardize, #\[Transpose], 2]\[Transpose] &@mylist
$\endgroup$ – user1066 Jun 10 '13 at 16:54