logo-header

 
 

 syntax

  • rth_element(a, r) 
  • rth_element(a, r, relation)

 defintion

rth_element(a, r) results in a parameter with the r * (n-1)th element of the ascending sorted data item a (n = number of elements).

rth_element(a, r, relation) results in an attribute with for each partition the r * (n-1)th elements of the ascending sorted data item a, grouped by the relation (n = number of elements within a partition) attribute. The domain unit of the result is the values unit of the relation attribute.

The values unit of the result should match the values unit of attribute a.

description

If r*(n-1) is not an integer, a weighted mean is calculated from the values that relate to the two nearest indices.
When r = 0.5, the function results in the median of a.

applies to

Attribute a with Numeric, uint2, uint4 or bool value type

Data item r with float32 value type

Relation attribute with value type of the group CanBeDomainUnit

conditions

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 of arguments a and relation must match, the domain of argument r must be the same as the result domain or void.

since version

5.61

example

parameter<uint32> rth_elementNrInh := 
rth_element(City/NrInhabitants, 0.5f);
result = 400
attribute<float32> rth_elementNrInhRegion (Region) :=
rth_element(
City/NrInhabitants
,0.5f
,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

rth_elementNrInhRegion
550
512
300
200
null
domain Region, nr of rows = 5

see also


OBJECT VISION BV
Vrije Universiteit
De Boelelaan 1085
1081 HV Amsterdam
The Netherlands

tel: +31 (0)20 598 9083
fax:+31 (0)20 598 9904