Library: | xplore |
See also: | mean sumex |
Quantlet: | meanex | |
Description: | an extended form of the mean function - NaN and all values contained in excl are excluded from computation |
Usage: | meanx = meanex(x{, excl {, s}}) | |
Input: | ||
x | d1 x d2 x .. x dn array, n <= 7 | |
excl | a matrix containing values to be excluded | |
s | integer (number of dimension, default = 1) | |
Output: | ||
meanx | d1 x d2 x .. x d(j-1) x 1 x d(j+1) x .. x dn array |
library("xplore") randomize(666) x = rint(10 * uniform(2, 4)) x[2,1] = NaN x excl = 2 meanex(x,excl)
Contents of x [1,] 3 1 7 4 [2,] +NAN 9 9 2 Contents of meanx [1,] 3 5 8 4