Mean - ObjectVision/GeoDMS GitHub Wiki
- mean(a)
- mean(a, relation)
- mean(a) results in a parameter with the average of the non null values of attribute a.
- mean(a, relation) results in an attribute with the average of the non null values of attribute a, grouped by relation. The domain unit of the resulting attribute is the values unit of the relation.
- attribute a with Numeric value type
- relation with value type of the group CanBeDomainUnit
- The values unit of the resulting data item should match with regard to value type and metric with the values unit of attribute a.
- The domain unit of argument a and relation must match.
- Without relation: O(n) where n = number of elements in the domain of a. Single pass accumulating sum and count.
- With relation: O(n) where n = number of elements in the domain of a. Aggregates values into groups during a single pass.
parameter<uint32> meanNrInh := mean(City/NrInhabitants); result = 375
attribute<uint32> meanNrInhRegion (Region) := mean(City/NrInhabitants, City/Region_rel);
| City/NrInhabitants | City/Region_rel |
|---|---|
| 550 | 0 |
| 525 | 1 |
| 300 | 2 |
| 500 | 1 |
| 200 | 3 |
| 175 | null |
| null | 3 |
domain City, nr of rows = 7
| meanNrInhRegion |
|---|
| 550 |
| 512 |
| 300 |
| 200 |
| null |
domain Region, nr of rows = 5