KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I often have a list of pairs, as data = {{0,0.0},{1,12.4},{2,14.6},{3,25.1}} and I want to do something, for instance Rescale , to all of the second elements without touching the first elements. The neatest way I know is: Transpose[MapAt[Rescale, Transpose[data], 2]] There must be a way to do this without so much Transpose ing. My wish is for something like this to work: MapAt[Rescale, data, {All, 2}] But my understanding is that MapAt takes Position -style specifications instead of Part -style specifications. What's the proper solution? To clarify, I'm seeking a solution where I don't have to repeat myself, so lacking double Transpose or double [[All,2]] , because I consider repetition a signal I'm not doing something the easiest way. However, if eliminating the repetition requires the introduction of intermediate variables or a named function or other additional complexity, maybe the transpose/untranspose solution is already correct.
Tags (comma-separated)
Save Edits
Cancel