-
Notifications
You must be signed in to change notification settings - Fork 1
modus_count
Jip Claassens edited this page Jul 7, 2026
·
1 revision
Aggregation functions modus_count
- modus_count_uint8/32/64(a)
- modus_count_uint8/32/64(a, relation)
- modus_count_uint8/32/64(a) results in a parameter with the number of occurrences of the most occurring non null value of attribute a, in other words the frequency of the modus.
- modus_count_uint8/32/64(a, relation) results in an attribute with the number of occurrences of the most occurring non null value of attribute a, grouped by relation. The domain unit of the resulting attribute is the values unit of the relation.
- The suffix of the function name determines the value type of the resulting data item: uint8, uint32 or uint64. There is no modus_count function without a suffix, so choose a variant that can contain the highest frequency that can occur.
- The variant resulting in a uint16 data item is registered under the name modus_count_uint17 (a naming irregularity in the GeoDMS source code); a function named modus_count_uint16 is not available.
- If attribute a contains no non null values (for a group), the resulting count is 0, whereas the modus function results in null in that case.
- attribute a with a numeric or string value type
- relation with a value type of the group CanBeDomainUnit
The domain of argument a and relation must match.
The implementation is shared with the modus function:
- Without relation: O(n) where n = number of elements in the domain of a. Builds a frequency count for each value.
- With relation: O(n) where n = number of elements in the domain of a. Builds a frequency count per group.
- Memory usage depends on the cardinality of the values unit.
parameter<uint32> modusCountLifeStyleCode := modus_count_uint32(City/LifeStyleCode); result = 3
attribute<uint32> modusCountLifeStyleCodeRegion (RegionDomain) := modus_count_uint32(City/LifeStyleCode, City/Region_rel);
| City/LifeStyleCode | City/Region_rel |
|---|---|
| 2 | 0 |
| 0 | 1 |
| 1 | 2 |
| 0 | 1 |
| 1 | 3 |
| 1 | null |
| null | 3 |
domain City, nr of rows = 7
| modusCountLifeStyleCodeRegion |
|---|
| 1 |
| 2 |
| 1 |
| 1 |
| 0 |
domain Region, nr of rows = 5
The most occurring non null value of the whole attribute is 1, occurring 3 times. In region 1 the value 0 occurs twice. Region 4 has no related rows, resulting in a count of 0.
GeoDMS ©Object Vision BV. Source code distributed under GNU GPL-3. Documentation distributed under CC BY-SA 4.0.