From 38a2d27a06e8b629e76b65c6163cd943f748d349 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 13 Aug 2023 19:46:36 +0200 Subject: [PATCH] docs --- R/row_means.R | 11 ++++++----- man/row_means.Rd | 13 +++++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/R/row_means.R b/R/row_means.R index 6b3f57133..bd2845499 100644 --- a/R/row_means.R +++ b/R/row_means.R @@ -22,11 +22,12 @@ #' #' @details Rounding to a negative number of `digits` means rounding to a power of #' ten, for example `row_means(df, 3, digits = -2)` rounds to the nearest hundred. -#' For `n`, must be a numeric value from `0` to `ncol(data)`. If a row in the -#' data frame has at least `n` non-missing values, the row mean is returned. If -#' `n` is a non-integer value from 0 to 1, `n` is considered to indicate the -#' proportion of required non-missing values per row. E.g., if `n = 0.75`, a -#' row must have at least `ncol(data) * n` non-missing values for the row mean +#' For `min_valid`, if not `NULL`, `min_valid` must be a numeric value from `0` +#' to `ncol(data)`. If a row in the data frame has at least `min_valid` +#' non-missing values, the row mean is returned. If `min_valid` is a non-integer +#' value from 0 to 1, `min_valid` is considered to indicate the proportion of +#' required non-missing values per row. E.g., if `min_valid = 0.75`, a row must +#' have at least `ncol(data) * min_valid` non-missing values for the row mean #' to be calculated. See 'Examples'. #' #' @examples diff --git a/man/row_means.Rd b/man/row_means.Rd index 43aa64a60..9ebd05c12 100644 --- a/man/row_means.Rd +++ b/man/row_means.Rd @@ -47,11 +47,12 @@ valid (and not \code{NA}). \details{ Rounding to a negative number of \code{digits} means rounding to a power of ten, for example \code{row_means(df, 3, digits = -2)} rounds to the nearest hundred. -For \code{n}, must be a numeric value from \code{0} to \code{ncol(data)}. If a row in the -data frame has at least \code{n} non-missing values, the row mean is returned. If -\code{n} is a non-integer value from 0 to 1, \code{n} is considered to indicate the -proportion of required non-missing values per row. E.g., if \code{n = 0.75}, a -row must have at least \code{ncol(data) * n} non-missing values for the row mean +For \code{min_valid}, if not \code{NULL}, \code{min_valid} must be a numeric value from \code{0} +to \code{ncol(data)}. If a row in the data frame has at least \code{min_valid} +non-missing values, the row mean is returned. If \code{min_valid} is a non-integer +value from 0 to 1, \code{min_valid} is considered to indicate the proportion of +required non-missing values per row. E.g., if \code{min_valid = 0.75}, a row must +have at least \code{ncol(data) * min_valid} non-missing values for the row mean to be calculated. See 'Examples'. } \examples{ @@ -77,7 +78,7 @@ row_means(dat, min_valid = 3) # 2 valid return values # needs at least 2 non-missing values per row row_means(dat, min_valid = 2) -# needs at least 1 non-missing value per row +# needs at least 1 non-missing value per row, for two selected variables row_means(dat, select = c("c1", "c3"), min_valid = 1) # needs at least 50\% of non-missing values per row