Reg_count
aggregation-functions reg_count
syntax
- reg_count(a, b, c, d)
definition
reg_count(a, b, c, d) results in a set of attributes with the count of the non null values of attribute a, for each value class in a named by attribute b per region towards the regional level defined in the string attribute d.
The labels in this string attribute d need to refer to the names of the relations in container c.
The values-unit for each resulting data-item is uint32 and the domain units depend on the values unit of the corresponding relations.
The reg_count_uint16/reg_count_uint8 versions can be used in the same manner as the reg_count function, resulting in data items with a uint16 or uint8 values unit.
applies to
- attribute a with uint32 value-type
- attribute b with string value type
- container c
- attribute d with string value type
conditions
- The domain unit of attribute a must match with the domain of the attribute in container c.
- The values unit of attribute a has to be the domain of attributes b and d.
- The values of attribute d need to refer to subitem attributes in container c.
- The value type of the attribute in container c must be of the group CanBeDomainUnit.
since version
5.85
example
container reg_count
{
container units
{
unit<uint32> Domain: nrofrows = 10;
unit<uint8> RegioA: nrofrows = 5;
unit<uint8> RegioB: nrofrows = 3;
unit<uint8> Class: nrofrows = 4
{
attribute<string> label: ['Class1','Class2','Class3','Class4'];
}
}
container regios
{
attribute<units/RegioA> A (units/Domain): [0,0,1,2,3,0,4,2,1,0];
attribute<units/RegioB> B (units/Domain): [1,0,2,2,0,0,1,2,1,0];
}
attribute<units/Class> src (units/Domain): [0,1,3,2,0,1,2,1,0,3];
attribute<string> refs (units/Class): ['A','A','B','A'];
container attributes :=
reg_count(
src
, units/Class/label
, Regios
, refs
);
};
attributes/class1 | attributes/class2 | attributes/class4 |
---|---|---|
1 | 2 | 1 |
1 | 0 | 1 |
0 | 1 | 0 |
1 | 0 | 0 |
0 | 0 | 0 |
domain RegioA, nr of rows = 5
attributes/class3 |
---|
0 |
1 |
1 |
domain RegioB, nr of rows = 3