From ff727394c9551fc3662b67a8128a10d80145f05a Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 17 Dec 2024 23:36:59 +0100 Subject: [PATCH] fix --- R/rescale_weights.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/R/rescale_weights.R b/R/rescale_weights.R index b7e5eedbd..7b7715038 100644 --- a/R/rescale_weights.R +++ b/R/rescale_weights.R @@ -151,6 +151,10 @@ rescale_weights <- function(data, insight::format_error("Argument `by` must be specified. Please provide one or more variable names in `by` that indicate the grouping structure (strata) of the survey data (level-2-cluster variable).") # nolint } + if (!by %in% colnames(data_tmp)) { + insight::format_error("The variable specified in `by` was not found in the data. Maybe misspelled?") # nolint + } + if (nest && length(by) < 2) { insight::format_warning( sprintf(