- java.lang.Object
-
- com.pervasive.datarush.functions.Statistics
-
public class Statistics extends Object
Provides implementations of common statistical functions. These functions are for calculating aggregations within the fields of a record. To calculate aggregations over an entire data set, useGroupinstead.- See Also:
ScalarValuedFunction,DeriveFields
-
-
Constructor Summary
Constructors Constructor Description Statistics()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ScalarValuedFunctionavg(String... fields)Builds an expression computing the average of the values of the specified fields.static ScalarValuedFunctionavg(List<ScalarValuedFunction> exprs)Builds an expression computing the average of the specified expressions.static ScalarValuedFunctionwavg(String[] fields, double[] weights)Builds an expression computing the weighted average of the values of the specified fields.static ScalarValuedFunctionwavg(List<ScalarValuedFunction> exprs, double[] weights)Builds an expression computing the weighted average of the values of the specified expressions.
-
-
-
Method Detail
-
avg
public static ScalarValuedFunction avg(String... fields)
Builds an expression computing the average of the values of the specified fields.- Parameters:
fields- the fields to include in the average- Returns:
- a function evaluating the expression
-
avg
public static ScalarValuedFunction avg(List<ScalarValuedFunction> exprs)
Builds an expression computing the average of the specified expressions.- Parameters:
exprs- the expressions to include in the average- Returns:
- a function evaluating the expression
-
wavg
public static ScalarValuedFunction wavg(String[] fields, double[] weights)
Builds an expression computing the weighted average of the values of the specified fields.- Parameters:
fields- the fields to include in the averageweights- the weights to apply to each field- Returns:
- a function evaluating the expression
- Throws:
com.pervasive.datarush.graphs.physical.InvalidPropertyValueException- if the number of weights does not match the number of fields
-
wavg
public static ScalarValuedFunction wavg(List<ScalarValuedFunction> exprs, double[] weights)
Builds an expression computing the weighted average of the values of the specified expressions.- Parameters:
exprs- the expressions to include in the averageweights- the weights to apply to each expression- Returns:
- a function evaluating the expression
- Throws:
com.pervasive.datarush.graphs.physical.InvalidPropertyValueException- if the number of weights does not match the number of expressions or if no expressions are supplied
-
-