Re: Apply or Map on some parts of lists - help
- To: mathgroup at smc.vnet.net
- Subject: [mg115625] Re: Apply or Map on some parts of lists - help
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sun, 16 Jan 2011 05:56:41 -0500 (EST)
f[{x_, y_}] := {x, #/3.6 &[y]};
f[x_] := x;
Map[f, data, {3}]
Or using rules
data /. {x_, y_?AtomQ} -> {x, #/3.6 &[y]}
If you have numbers, you could use NumericQ rather than AtomQ
Bob Hanlon
---- dragec <culinovic at gmail.com> wrote:
=============
Dear,
I have
List like:
{ {{TITLE1},{{x11,y11},{x12,y12},{x13,y13},{x14,y14}}},
{{TITLE1},{{x21,y21},{x22,y22},{x23,y23},{x24,y24}}},
{{TITLE1},{{x31,y31},{x32,y32},{x33,y33},{x34,y34}}}
}
So, I would like to apply some function (eg. #/3.6&) to all y's.
Is there any elegant way to do this.
I Know that you know how to do this. :)
THX