Skip to main content

PQL46 (PQL Function Library - CPM 4.6)

RAGG

Applies to: CELONIS 4.2 CELONIS 4.3 CELONIS 4.4 CELONIS 4.5 CELONIS 4.6

Description

Transfer columns in groups to the R server. On each group the R-Script is applied and one result is expected.

Syntax
RAGG( table.column  AS  input_name  (,  table.column  AS  input_name )*, r_script)
  • table.column: Column(s) to be transferred to the R server

  • input_name: Name under which the column will be accessible in the R script

  • r_script: R script to be called

RAGG is an aggregation. It splits the input in groups and calls for each group the R script. The R script has to aggregate the group and return a single value.

Examples

[1] Execute RAGG to calculate the correlation of the example data from LINEAR_REGRESSION

Query

Column1

RAGG( "Table1"."Month" AS MONTH, "Table1"."Income" AS INCOME, 'cor(MONTH, INCOME)')

Input

Output

Table1

Month : INT

Income : INT

1

100

1

300

2

400

3

300

4

500

Result

Column1 : FLOAT

0.7497771504927777

[2] In this example the sum of a column is calculated via an R script, executed by RAGG.

Query

Column1

RAGG("Table1"."Column1" AS STRC, 'sum(STRC)')

Input

Output

Column1

Column1 : INT

0

1

2

3

4

Result

Column1 : INT

10