Learn R Programming

cards (version 0.3.0)

.fill_grps_from_variables: Back Fill Group Variables

Description

This function back fills the values of group variables using variable/variable_levels. The back filling will occur if the value of the variable column matches the name of a grouping variable, and the grouping variable's value is NA.

Usage

.fill_grps_from_variables(x)

Value

data frame

Arguments

x

(data.frame)
a data frame

Examples

Run this code
data <- data.frame(
  variable = c(rep("A", 3), rep("B", 2)),
  variable_level = 1:5,
  A = rep(NA, 5),
  B = rep(NA, 5)
)

cards:::.fill_grps_from_variables(data)

Run the code above in your browser using DataLab