Skip to content

Commit dd8ca23

Browse files
committed
docs
1 parent 456166b commit dd8ca23

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

R/rescale_weights.R

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@
2323
#' combination from each group level of the variables in `by`.
2424
#' @param method `"carle"` or `"kish"`.
2525
#'
26-
#' @return `data`, including the new weighting variables: `pweights_a`
27-
#' and `pweights_b`, which represent the rescaled design weights to use
28-
#' in multilevel models (use these variables for the `weights` argument).
26+
#' @return `data`, including the new weighting variable(s). For
27+
#' `method = "carle"`, new columns `pweights_a` and `pweights_b` are returned,
28+
#' and for `method = "klish"`, the returned data contains a column `pweights`.
29+
#' These represent the rescaled design weights to use in multilevel models (use
30+
#' these variables for the `weights` argument).
2931
#'
3032
#' @details
3133
#' - `method = "carle"`
@@ -110,6 +112,11 @@ rescale_weights <- function(data,
110112
by <- all.vars(by)
111113
}
112114

115+
# check for existing variable names
116+
if (any(c("pweights_a", "pweights_b", "pweights") %in% colnames(data))) {
117+
insight::format_warning("The variable name for the rescaled weights already exists in the data. Existing columns will be overwritten.")
118+
}
119+
113120
# check if weight has missings. we need to remove them first,
114121
# and add back weights to correct cases later
115122

man/rescale_weights.Rd

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)