From fea5b33540e0f2b4206ad3c87f6a0a8cd3d35674 Mon Sep 17 00:00:00 2001 From: aho Date: Thu, 22 Oct 2020 14:28:11 +0200 Subject: [PATCH] Add details in MeanDims() --- R/MeanDims.R | 3 +++ man/MeanDims.Rd | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/R/MeanDims.R b/R/MeanDims.R index 8a6dc56..2da3144 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 ed621e4..2e6022f 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))) -- GitLab