dot-fill_overall_grp_values: Fill Overall Group Variables

.fill_overall_grp_valuesR Documentation

Fill Overall Group Variables

Description

This function fills the missing values of grouping variables with "Overall ⁠variable name⁠" where relevant. Specifically it will modify grouping values from rows with likely overall calculations present (e.g. non-missing variable/variable_level, 100 percent missing group variables, and evidence that the variable has been computed by group in other rows). "Overall" values will be populated only for grouping variables that have been used in other calculations of the same variable and statistics.

Usage

.fill_overall_grp_values(x, vars_protected)

Arguments

x

(data.frame)
a data frame

Value

data frame

Examples

data <- dplyr::tibble(
  grp = c("AA", "AA", NA, "BB", NA),
  variable = c("A", "B", "A", "C", "C"),
  variable_level = c(1, 2, 1, 3, 3),
  A = rep(NA, 5),
  B = rep(NA, 5),
  .cards_idx = c(1:5)
)

cards:::.fill_overall_grp_values(data, vars_protected = ".cards_idx")

cards documentation built on Oct. 4, 2024, 1:09 a.m.