Navigation
Synopsis Compute a distribution: count how many times events are mapped to which bucket.
Function
  1. map[&T, int] distribution(rel[&U event, &T bucket] input)
  2. map[&T <: num, int] distribution(rel[&U event, &T <: num bucket] input, &T <: num bucketSize)
  3. map[&T, int] distribution(map[&U event, &T bucket] input)
  4. map[&T <: num, int] distribution(map[&U event, &T <: num bucket] input, &T <: num bucketSize)
Usage import analysis::statistics::Frequency;
Examples
rascal>import analysis::statistics::Frequency;
ok
rascal>distribution({<"chicken","animal">,<"bear","animal">,<"oak","plant">,<"tulip","plant">});
map[str, int]: ("plant":2,"animal":2)
rascal>distribution({<"alice",2>,<"bob",3>,<"claire",5>},5);
map[int, int]: (0:1,5:2)
Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.