| product_vars | R Documentation | 
Creates new variables by applying conditions to specified columns
(fork_vars) and retaining or modifying values from other columns (vars)
based on keep_values.
Generates new variables with _product suffix.
product_vars(data, fork_vars, vars, keep_values)
data | 
 A data frame containing the input data  | 
fork_vars | 
 Character vector of column names to use as logical
conditions, evaluated against   | 
vars | 
 Character vector of column names whose values will be retained or
modified based on conditions in   | 
keep_values | 
 Vector of values in   | 
A data frame with new _product suffixed variables. Excludes
intermediate logical columns.
product_vars(
  data = tibble::tibble(
    var_av = c("1", "2", "3", "4", "5", NA, "999", "777"),
    var_al = c("5", "4", "3", "2", "1", "777", NA, "999"),
    var_bv = c("1", "1", "36", "2", "1", NA, "999", "777"),
    var_bl = c("5", "2", "2", "2", "1", "777", NA, "999")
  ),
  fork_vars = c("var_al", "var_bl"),
  vars = c("var_av", "var_bv"),
  keep_values = "2"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.