December 2018
Beginner to intermediate
500 pages
12h 10m
English
The @group statement groups elements by some attribute:
julia> @from p in shopping_info begin
@group p.produce by p.allergenic
@collect
end
2-element Array{Grouping{Bool,String},1}:
["Apples"]
["Milk", "Bread"]
Not bad, but what we'd really like is to summarize the data. Query provides this under the name split-apply-combine (also known as, dplyr). This requires an aggregation function that will be used to collapse the dataset based on the Grouping variable. If that's too abstract, an example will surely clear things up.
Say we want to get a count of allergenic items together with a comma-separated list of their names, so we know what to stay away from:
@from p in shopping_info begin @group p by p.allergenic into q @select { allergenic ...Read now
Unlock full access