r_mean(C;S)
Returns the mean of values across a given set of columns.
Function type
Vector only
Syntax
r_mean(C;S)
Input
Argument | Type | Description |
---|---|---|
C |
integer or decimal | A space- or comma-separated list of column names
If N/A values in |
S |
integer | A boolean column or an expression in
rcv_ /rcn_ /rct_ which determines
whether or not that column is selected to be included in the calculation. See System variables for more information about
rcv_ /rcn_ /rct_ .If
|
Return Value
For each row of the table, r_mean
returns a decimal value corresponding to
the mean of the non-N/A values in the columns specified by C
.
If all the values in the columns specified by C
are N/A, the result is
0.
Sample Usage
c1 |
c2 |
c3 |
c4 |
r_mean(;) |
r_mean(c1 c2;) |
---|---|---|---|---|---|
2 | 5 | 7 | 2 | 4 | 3.5 |
7 | 7 | 4 | 1 | 4.75 | 7 |
NA | 0 | 9 | 3 | 4 | 0 |
NA | NA | NA | NA | 0 | 0 |