powered by
This function returns the mean of an array along a set of dimensions and preserves the dimension names if it has.
MeanDims(data, dims, na.rm = TRUE)
An array to be averaged.
A vector of numeric or charactor string, indicating along which dimensions to average.
A logical value indicating whether to ignore NA values (TRUE) or not (FALSE).
An array with the same dimension as parameter 'data' except the 'dims' dimensions. removed.
# NOT RUN { a <- array(rnorm(24), dim = c(a = 2, b= 3, c = 4)) print(dim(MeanDims(a, 2))) print(dim(MeanDims(a, c(2, 3)))) print(dim(MeanDims(a, c('a', 'b')))) # }
Run the code above in your browser using DataLab