data <- tibble::tibble(
var_id = c("A", "B", "C"),
var_orig = c(1, NA, 3),
var_alt = c(NA, 2, 4)
)
data |>
combine_cols(
col_1 = "var_orig",
col_2 = "var_alt"
)
data |>
combine_cols(
"var_orig",
"var_alt",
name = "out"
)
data |>
combine_cols(
"var_orig",
"var_alt",
name = "out",
keep_other = FALSE
)
Run the code above in your browser using DataLab