diff --git a/R/MeanDims.R b/R/MeanDims.R index 8a6dc56856c30630e90770e3ecec7321b48a58ea..2da3144c55259551d7f7cb30fef36f26776d0e17 100644 --- a/R/MeanDims.R +++ b/R/MeanDims.R @@ -3,6 +3,9 @@ #'This function returns the mean of an array along a set of dimensions and #'preserves the dimension names if it has. #' +#'@details It is recommended to use \code{'apply(x, dim, mean)'} to improve the +#' efficiency when the dimension to be averaged is only one. +#' #'@param data An array to be averaged. #'@param dims A vector of numeric or charactor string, indicating along which #' dimensions to average. diff --git a/man/MeanDims.Rd b/man/MeanDims.Rd index ed621e48f4af6bae862920fea2fec60191d84be8..2e6022f7b5bdaf41d9e37606a4b0838b04f236a8 100644 --- a/man/MeanDims.Rd +++ b/man/MeanDims.Rd @@ -24,6 +24,10 @@ An array with the same dimension as parameter 'data' except the 'dims' This function returns the mean of an array along a set of dimensions and preserves the dimension names if it has. } +\details{ +It is recommended to use \code{'apply(x, dim, mean)'} to improve the + efficiency when the dimension to be averaged is only one. +} \examples{ a <- array(rnorm(24), dim = c(a = 2, b= 3, c = 4)) print(dim(MeanDims(a, 2)))