Functions can easily be applied to columns of datasets, as in the documentation it is shown. Now I want to apply a function with parameters to a column, but I get a list rules. E.g.
dataset = Dataset[{
<|"a" -> 1, "b" -> "x", "c" -> {1}|>,
<|"a" -> 2, "b" -> "y", "c" -> {2, 3}|>,
<|"a" -> 3, "b" -> "z", "c" -> {3}|>,
<|"a" -> 4, "b" -> "x", "c" -> {4, 5}|>,
<|"a" -> 5, "b" -> "y", "c" -> {5, 6, 7}|>,
<|"a" -> 6, "b" -> "z", "c" -> {}|>}]
and
func[x_] := x^2
and additionally (just an example):
lmax[list_List, func] := Module[{temp = list}, {Max @ temp, func @ (Length@temp)}]
If I now do:
dataset[All, {"c" -> lmax[#c, func] &}]
I get the following:

So two questions:
- Why do I get this result.... where are the other columns?
- How can I manage it to get the dataset with the changed column "c"?
"c" -> (lmax[#c, func] &) // FullFormwill show you that your operator is a function. It will transform the entire row. You meant to use the syntax{"c" -> f}where onlyfis a function. In order to fix this, in other parts of Mathematica, it is common to write"c" -> (lmax[#c, func] &). This fixes the precedence issue but there is another problem with this which I believe is specific to this context, and it throws an error. You can get around it by defininglmax[func_][list_List] :=...and usingdataset[All, {"c" -> lmax[func]}]. – C. E. May 16 '15 at 12:04dataset[All, {"c" -> (lmax[#, func] &)}]– C. E. May 17 '15 at 16:26