diff --git a/R/standardize.R b/R/standardize.R index 726623e7c..0c88722b6 100644 --- a/R/standardize.R +++ b/R/standardize.R @@ -205,15 +205,9 @@ standardize.matrix <- function(x, ...) { x_out <- do.call(cbind, xz) dimnames(x_out) <- dimnames(x) - attr(x_out, "center") <- vapply(xz, function(x) { - attr(x, "center") - }, FUN.VALUE = numeric(1L)) - attr(x_out, "scale") <- vapply(xz, function(x) { - attr(x, "scale") - }, FUN.VALUE = numeric(1L)) - attr(x_out, "robust") <- vapply(xz, function(x) { - attr(x, "robust") - }, FUN.VALUE = logical(1L))[1] + attr(x_out, "center") <- vapply(xz, attr, "center", FUN.VALUE = numeric(1L)) + attr(x_out, "scale") <- vapply(xz, attr, "scale", FUN.VALUE = numeric(1L)) + attr(x_out, "robust") <- vapply(xz, attr, "robust", FUN.VALUE = logical(1L))[1] class(x_out) <- c("dw_transformer", class(x_out)) x_out diff --git a/man/describe_distribution.Rd b/man/describe_distribution.Rd index fd229567d..a23069eea 100644 --- a/man/describe_distribution.Rd +++ b/man/describe_distribution.Rd @@ -50,14 +50,9 @@ describe_distribution(x, ...) \item{...}{Additional arguments to be passed to or from methods.} -\item{centrality}{The point-estimates (centrality indices) to compute. Character -(vector) or list with one or more of these options: \code{"median"}, \code{"mean"}, \code{"MAP"} -(see \code{\link[bayestestR:map_estimate]{map_estimate()}}), \code{"trimmed"} (which is just \code{mean(x, trim = threshold)}), -\code{"mode"} or \code{"all"}.} +\item{centrality}{The point-estimates (centrality indices) to compute. Character (vector) or list with one or more of these options: \code{"median"}, \code{"mean"}, \code{"MAP"} or \code{"all"}.} -\item{dispersion}{Logical, if \code{TRUE}, computes indices of dispersion related -to the estimate(s) (\code{SD} and \code{MAD} for \code{mean} and \code{median}, respectively). -Dispersion is not available for \code{"MAP"} or \code{"mode"} centrality indices.} +\item{dispersion}{Logical, if \code{TRUE}, computes indices of dispersion related to the estimate(s) (\code{SD} and \code{MAD} for \code{mean} and \code{median}, respectively).} \item{iqr}{Logical, if \code{TRUE}, the interquartile range is calculated (based on \code{\link[stats:IQR]{stats::IQR()}}, using \code{type = 6}).} @@ -76,9 +71,7 @@ the first centrality index (which is typically the median).} \item{iterations}{The number of bootstrap replicates for computing confidence intervals. Only applies when \code{ci} is not \code{NULL}.} -\item{threshold}{For \code{centrality = "trimmed"} (i.e. trimmed mean), indicates -the fraction (0 to 0.5) of observations to be trimmed from each end of the -vector before the mean is computed.} +\item{threshold}{For \code{centrality = "trimmed"} (i.e. trimmed mean), indicates the fraction (0 to 0.5) of observations to be trimmed from each end of the vector before the mean is computed.} \item{verbose}{Toggle warnings and messages.} diff --git a/tests/testthat/_snaps/means_by_group.md b/tests/testthat/_snaps/means_by_group.md index 78a43d8b4..e49faebc3 100644 --- a/tests/testthat/_snaps/means_by_group.md +++ b/tests/testthat/_snaps/means_by_group.md @@ -1,4 +1,4 @@ -# meany_by_group +# mean_by_group Code means_by_group(efc, "c12hour", "e42dep") diff --git a/tests/testthat/_snaps/windows/means_by_group.md b/tests/testthat/_snaps/windows/means_by_group.md index 198069da9..6f80d7e25 100644 --- a/tests/testthat/_snaps/windows/means_by_group.md +++ b/tests/testthat/_snaps/windows/means_by_group.md @@ -1,4 +1,4 @@ -# meany_by_group, weighted +# mean_by_group, weighted Code means_by_group(efc, "c12hour", "e42dep", weights = "weight")