Previous: Tabulating values, Up: Statistics [Contents]
In the above example, the number of values is small (the seven weekdays); however, in many cases there can be many different values (for example, all different message subjects), many of which may not be very interesting – all we need to know is the top-10 of most frequently seen values.
This is fairly easy to achieve using mu:tabulate
– to get the top-10
subjects8, we can use
something like this:
(take (sort (mu:tabulate mu:subject) (lambda (a b) (> (cdr a) (cdr b)))) 10)
If this is not short enough, mu-guile offers a convenience procedure to do
this: mu:top-n-most-frequent
. For example, to get the top-10 people we
sent mail to most often:
(mu:top-n-most-frequent mu:to 10 "maildir:/sent")
Can’t make it much easier than that!