Skip to content

Commit

Permalink
Merge pull request #161 from bschneidr/prop-docs
Browse files Browse the repository at this point in the history
Documented how to get `na.rm = TRUE` behavior for proportions
  • Loading branch information
gergness authored Oct 16, 2023
2 parents 74e47ef + 1dedf18 commit 1917f75
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
13 changes: 12 additions & 1 deletion R/survey_statistics.r
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
#' allows for "unpeeling" multiple variables at once.
#'
#' @param x A variable or expression, or empty
#' @param na.rm A logical value to indicate whether missing values should be dropped
#' @param na.rm A logical value to indicate whether missing values should be dropped.
#' See the section "Missing Values" later in this help page.
#' @param vartype Report variability as one or more of: standard error ("se", default),
#' confidence interval ("ci"), variance ("var") or coefficient of variation
#' ("cv").
Expand All @@ -30,6 +31,16 @@
#' but Inf is the usual survey package's default (except in
#' \code{\link[survey]{svyciprop}}.
#' @param ... Ignored
#' @section Missing Values:
#' When calculating proportions for a grouping variable \code{x}, \code{NA} values
#' will affect the estimated proportions unless they are first removed by calling
#' \code{filter(!is.na(x))}.
#'
#' When calculating means for a numeric variable, equivalent results are obtained
#' by calling \code{filter(!is.na(x))} or using \code{survey_mean(x, na.rm = TRUE)}.
#' However, it is better to use \code{survey_mean(x, na.rm = TRUE)} if
#' you are simultaneously producing summaries for other variables
#' that might not have missing values for the same rows as \code{x}.
#' @examples
#' data(api, package = "survey")
#'
Expand Down
16 changes: 15 additions & 1 deletion man/survey_mean.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1917f75

Please sign in to comment.