I'm not sure if you'll find this any cleaner, but maybe something like function summary2(df, queries...) d = Dict() for query in queries name = query[1] f = query[2] col = query[3] d[name] = f(df[col]) end return d end
Which could be used e.g. julia> summary2(dat, ("mu_x", mean, :x), ("std_y", std, :y)) Dict{Any,Any} with 2 entries: "std_y" => 0.338854 "mu_x" => 0.438158 julia> Admittedly this is less flexible, but perhaps more transparent.