I have a question regarding highlighting severals values in (column of) a dataset. Here a simple example:
names = StringJoin["name", #] & /@ ToString /@ Range[9];
values = RandomInteger[100, 9];
and then
ds = Dataset[AssociationThread[{"name", "value"} -> #] & /@ ({names,
values}\[Transpose])]
Now we have something like:
I now can highlight values in the Dataset with:
highLight1[x_] := Which[x < 0.9*50, Style[x, Blue],
x > 1.1*50, Style[x, Red],
True, x];
Now the following does what I desire, it applies a function to a column of the dataset:
ds[All, {"value" -> highLight1}]
What I could not manage to do is to make the highlighting work with a parameter, something like
Clear highLight;
highLight[x_, limit_] := Which[x < 0.9*limit, Style[x, Blue],
x > 1.1*limit, Style[x, Red],
True, x];
This does not work, even when I use a modified version which accepts a list as x_ in the highlight1 function.
So the question is, whether there is a clean and simple way to get the values highlighted in this "parametrized" way? (Maybe it is just simple and I do not see it...)



ds[All, {"value" -> (highLight[#, 50] &)}]– Karsten7 Aug 21 '16 at 18:48