Skip to content

Commit

Permalink
Revert "docs"
Browse files Browse the repository at this point in the history
This reverts commit c189e31.
  • Loading branch information
strengejacke committed Dec 18, 2024
1 parent c189e31 commit 260f0eb
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 41 deletions.
42 changes: 22 additions & 20 deletions R/rescale_weights.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,30 +60,32 @@
#' - Asparouhov T. (2006). General Multi-Level Modeling with Sampling
#' Weights. Communications in Statistics - Theory and Methods 35: 439-460
#'
#' @examplesIf insight::check_if_installed("lme4", quietly = TRUE)
#' data(nhanes_sample)
#' head(rescale_weights(nhanes_sample, "SDMVSTRA", "WTINT2YR"))
#' @examples
#' if (require("lme4")) {
#' data(nhanes_sample)
#' head(rescale_weights(nhanes_sample, "SDMVSTRA", "WTINT2YR"))
#'
#' # also works with multiple group-variables
#' head(rescale_weights(nhanes_sample, c("SDMVSTRA", "SDMVPSU"), "WTINT2YR"))
#' # also works with multiple group-variables
#' head(rescale_weights(nhanes_sample, c("SDMVSTRA", "SDMVPSU"), "WTINT2YR"))
#'
#' # or nested structures.
#' x <- rescale_weights(
#' data = nhanes_sample,
#' by = c("SDMVSTRA", "SDMVPSU"),
#' probability_weights = "WTINT2YR",
#' nest = TRUE
#' )
#' head(x)
#' # or nested structures.
#' x <- rescale_weights(
#' data = nhanes_sample,
#' by = c("SDMVSTRA", "SDMVPSU"),
#' probability_weights = "WTINT2YR",
#' nest = TRUE
#' )
#' head(x)
#'
#' nhanes_sample <- rescale_weights(nhanes_sample, "SDMVSTRA", "WTINT2YR")
#' nhanes_sample <- rescale_weights(nhanes_sample, "SDMVSTRA", "WTINT2YR")
#'
#' lme4::glmer(
#' total ~ factor(RIAGENDR) * (log(age) + factor(RIDRETH1)) + (1 | SDMVPSU),
#' family = poisson(),
#' data = nhanes_sample,
#' weights = pweights_a
#' )
#' glmer(
#' total ~ factor(RIAGENDR) * (log(age) + factor(RIDRETH1)) + (1 | SDMVPSU),
#' family = poisson(),
#' data = nhanes_sample,
#' weights = pweights_a
#' )
#' }
#' @export
rescale_weights <- function(data, by, probability_weights, nest = FALSE) {
if (inherits(by, "formula")) {
Expand Down
42 changes: 21 additions & 21 deletions man/rescale_weights.Rd

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

0 comments on commit 260f0eb

Please sign in to comment.