Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 16 additions & 32 deletions facebook/delphiFacebook/R/variables.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -665,22 +671,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)
Expand Down Expand Up @@ -713,6 +707,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
}
Expand All @@ -733,22 +728,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)

Expand Down Expand Up @@ -779,6 +762,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
}
Expand Down