Operationalizes outcomes of type yes/no to binary variables. It is internally given the values to count as a "Yes" by regular expression, e.g. not only "Yes" but also "Support" and "For"
yesno_to_binary(vec, DK_to_NA = TRUE)
A vector of integers
yesno_to_binary(
c("Yes",
"No",
"Support",
"Oppose",
"Somewhat support",
"Somewhat oppose",
"For this bill",
"Against this bill",
"Not sure",
"Don't Know",
NA_character_)
)
#> [1] 1 0 1 0 1 0 1 0 NA NA NA