From 93b68fa8ffd917732ddae1218804e4a1997114b1 Mon Sep 17 00:00:00 2001 From: Nat DeFries <42820733+nmdefries@users.noreply.github.com> Date: Tue, 28 Dec 2021 10:30:00 -0600 Subject: [PATCH 1/2] combine V15a/c logic properly --- facebook/delphiFacebook/R/variables.R | 42 +++++++-------------------- 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/facebook/delphiFacebook/R/variables.R b/facebook/delphiFacebook/R/variables.R index 0fb47e755..0e2728130 100644 --- a/facebook/delphiFacebook/R/variables.R +++ b/facebook/delphiFacebook/R/variables.R @@ -665,22 +665,10 @@ code_vaccines <- function(input_data, wave) { input_data$v_vaccine_barrier_time <- is_selected(vaccine_barriers, "10") input_data$v_vaccine_barrier_type <- is_selected(vaccine_barriers, "12") input_data$v_vaccine_barrier_none <- is_selected(vaccine_barriers, "11") - } else { - input_data$v_vaccine_barrier_eligible <- NA - input_data$v_vaccine_barrier_no_appointments <- NA - input_data$v_vaccine_barrier_appointment_time <- NA - input_data$v_vaccine_barrier_technical_difficulties <- NA - input_data$v_vaccine_barrier_document <- NA - input_data$v_vaccine_barrier_technology_access <- NA - input_data$v_vaccine_barrier_travel <- NA - input_data$v_vaccine_barrier_language <- NA - input_data$v_vaccine_barrier_childcare <- NA - input_data$v_vaccine_barrier_time <- NA - input_data$v_vaccine_barrier_type <- NA - input_data$v_vaccine_barrier_none <- NA - } - - if ( all(c("V15c", "V15b") %in% names(input_data)) ) { + + input_data$v_vaccine_barrier_appointment_location <- NA + input_data$v_vaccine_barrier_other <- NA + } else if ( all(c("V15c", "V15b") %in% names(input_data)) ) { # V15c introduced in Wave 12, replacing V15a with clarified wording. vaccine_barriers <- coalesce(input_data$V15c, input_data$V15b) vaccine_barriers <- ifelse(vaccine_barriers == "13", NA, vaccine_barriers) @@ -713,6 +701,7 @@ code_vaccines <- function(input_data, wave) { input_data$v_vaccine_barrier_time <- NA input_data$v_vaccine_barrier_type <- NA input_data$v_vaccine_barrier_none <- NA + input_data$v_vaccine_barrier_appointment_location <- NA input_data$v_vaccine_barrier_other <- NA } @@ -733,22 +722,10 @@ code_vaccines <- function(input_data, wave) { input_data$v_vaccine_barrier_time_has <- is_selected(vaccine_barriers, "10") input_data$v_vaccine_barrier_type_has <- is_selected(vaccine_barriers, "12") input_data$v_vaccine_barrier_none_has <- is_selected(vaccine_barriers, "11") - } else { - input_data$v_vaccine_barrier_eligible_has <- NA - input_data$v_vaccine_barrier_no_appointments_has <- NA - input_data$v_vaccine_barrier_appointment_time_has <- NA - input_data$v_vaccine_barrier_technical_difficulties_has <- NA - input_data$v_vaccine_barrier_document_has <- NA - input_data$v_vaccine_barrier_technology_access_has <- NA - input_data$v_vaccine_barrier_travel_has <- NA - input_data$v_vaccine_barrier_language_has <- NA - input_data$v_vaccine_barrier_childcare_has <- NA - input_data$v_vaccine_barrier_time_has <- NA - input_data$v_vaccine_barrier_type_has <- NA - input_data$v_vaccine_barrier_none_has <- NA - } - - if ( "V15c" %in% names(input_data) ) { + + input_data$v_vaccine_barrier_appointment_location_has <- NA + input_data$v_vaccine_barrier_other_has <- NA + } else if ( "V15c" %in% names(input_data) ) { # V15c introduced in Wave 12, replacing V15a with clarified wording. vaccine_barriers <- split_options(input_data$V15c) @@ -779,6 +756,7 @@ code_vaccines <- function(input_data, wave) { input_data$v_vaccine_barrier_time_has <- NA input_data$v_vaccine_barrier_type_has <- NA input_data$v_vaccine_barrier_none_has <- NA + input_data$v_vaccine_barrier_appointment_location_has <- NA input_data$v_vaccine_barrier_other_has <- NA } From be08fb10d049bc0568a052d78f27d293ba512d24 Mon Sep 17 00:00:00 2001 From: Nat DeFries <42820733+nmdefries@users.noreply.github.com> Date: Tue, 28 Dec 2021 14:59:48 -0600 Subject: [PATCH 2/2] comment describing V15abc inclusion by wave --- facebook/delphiFacebook/R/variables.R | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/facebook/delphiFacebook/R/variables.R b/facebook/delphiFacebook/R/variables.R index 0e2728130..6baa4ca39 100644 --- a/facebook/delphiFacebook/R/variables.R +++ b/facebook/delphiFacebook/R/variables.R @@ -639,6 +639,12 @@ code_vaccines <- function(input_data, wave) { input_data$v_worried_vaccine_side_effects <- NA_real_ } + + # Wave V15a V15b V15c + # 11 Yes Yes No + # 12 No Yes Yes + # + # V15c replaces V15a as of Wave 12 if ( all(c("V15a", "V15b") %in% names(input_data)) ) { # introduced in Wave 11 vaccine_barriers <- coalesce(input_data$V15a, input_data$V15b)