@@ -1080,6 +1080,36 @@ code_behaviors <- function(input_data, wave) {
10801080 } else {
10811081 input_data $ c_direct_contact <- NA
10821082 }
1083+
1084+ # avoid_contact
1085+ # Percentage of respondents that have reported having intentionally avoided
1086+ # contact with other people all or most of the time
1087+ # 1 = all of the time, 2 = most of the time, 3 = some of the time,
1088+ # 4 = none of the time
1089+ if (" C7" %in% names(input_data )) {
1090+ input_data $ c_avoid_contact <- case_when(
1091+ input_data $ C7 %in% c(1 , 2 ) ~ 1 ,
1092+ input_data $ C7 %in% c(3 , 4 ) ~ 0 ,
1093+ TRUE ~ NA_real_
1094+ )
1095+ } else {
1096+ input_data $ c_avoid_contact <- NA_real_
1097+ }
1098+
1099+ # avoid_contact_7d
1100+ # Percentage of respondents that have reported having intentionally avoided
1101+ # contact with other people all or most of the time in the last 7 days
1102+ # 1 = all of the time, 2 = most of the time, 3 = some of the time,
1103+ # 4 = a little of the time, 5 = none of the time
1104+ if (" C7a" %in% names(input_data )) {
1105+ input_data $ c_avoid_contact_7d <- case_when(
1106+ input_data $ C7a %in% c(1 , 2 ) ~ 1 ,
1107+ input_data $ C7a %in% c(3 , 4 , 5 ) ~ 0 ,
1108+ TRUE ~ NA_real_
1109+ )
1110+ } else {
1111+ input_data $ c_avoid_contact_7d <- NA_real_
1112+ }
10831113
10841114 return (input_data )
10851115}
0 commit comments