-
Notifications
You must be signed in to change notification settings - Fork 0
/
defineFactors.R
324 lines (256 loc) · 14.7 KB
/
defineFactors.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
df$siv <- factor(df$siv,
levels = c("Yes",
"No",
"I don't know"))
df$citizen <- factor(df$citizen,
levels = c("Yes",
"No"))
df$usTies <- factor(df$usTies,
levels = c("Yes, I registered a United States contact before arriving",
"Yes, I have some acquaintances or relatives (but did not register a contact)",
"No, I did not know anyone in the United States"))
df$cosponsorship <- factor(df$cosponsorship,
levels = c("Yes",
"No"))
df$maritalStatus <- factor(df$maritalStatus,
levels = c("Now married",
"Widowed",
"Divorced",
"Separated",
"Never married",
"Other"))
df$gender <- factor(df$gender,
levels = c("Female",
"Male",
"Non-binary",
"Transgender",
"Prefer not to say",
"Prefer to self-describe"))
df$educationLevel <- factor(df$educationLevel,
levels = c(
"No formal education",
"Primary education (6 years or less)",
"Some high school (between 6 – 12 years)",
"High school (12 + years)",
"Some vocational training",
"Completed vocational training",
"Some university",
"Received university degree",
"Received Master’s degree or higher"))
df$whatsAppConsent <- factor(df$whatsAppConsent,
levels = c("Yes",
"No"))
df$languageSurvey <- factor(df$languageSurvey,
levels = c("Arabic",
"Dari/Farsi",
"English",
"French",
"Russian",
"Spanish",
"Swahili"))
df$textConsent <- factor(df$textConsent,
levels = c("Yes",
"No"))
df$followUpSurveyType <- factor(df$followUpSurveyType,
levels = c("SMS",
"WhatsApp"))
df$hoursWorkedJanuary <- factor(df$hoursWorkedJanuary,
levels = c("Less than 10",
"10 - 20",
"20 - 35",
"35 or more"))
df$housingJanuary <- factor(df$housingJanuary,
levels = c("House",
"Apartment",
"Mobile home",
"Other type of housing",
"No housing (homeless)"))
df$housingPaymentJanuary <- factor(df$housingPaymentJanuary,
levels = c("Owned free and clear",
"Owned with a mortgage or loan (including home equity loans)",
"Rented",
"Occupied without payment of rent"))
df$housingRentJanuary <- factor(df$housingRentJanuary,
levels = c("Yes",
"No",
"Payment was deferred"))
df$foodSecurity1January <- factor(df$foodSecurity1Baseline,
level = c("Enough of the kinds of food (I/we) wanted to eat",
"Enough, but not always the kinds of food (I/we) wanted to eat",
"Sometimes not enough to eat",
"Often not enough to eat"))
df$foodSecurity3January <- factor(df$foodSecurity3January,
levels = c("Yes",
"No",
"Payment was deferred"))
df$foodSecurity4January <- factor(df$foodSecurity4January,
level = c("Not at all confident",
"Somewhat confident",
"Moderately confident",
"Very confident"))
df$healthJanuary <- factor(df$healthJanuary,
levels = c("Excellent",
"Very good",
"Good",
"Fair",
"Poor"))
df$workStatusJanuary <- factor(df$workStatusJanuary,
level = c("In paid work (employee, self-employed, working for your family business)",
"In school, even if on vacation",
"Unemployed and actively looking for a job",
"Unemployed and not actively looking for a job",
"Permanently sick or disabled",
"Retired",
"In military service",
"In community service",
"Doing unpaid housework, looking after children or other persons",
"Other (please specify)"))
df$schoolJanuary <- factor(df$schoolJanuary,
levels = c("Yes, enrolled in a public or private school",
"Yes, homeschooled",
"No"))
df$hoursWorkedBaseline <- factor(df$hoursWorkedBaseline,
levels = c("Less than 10",
"10 - 20",
"20 - 35",
"35 or more"))
df$housingBaseline <- factor(df$housingBaseline,
levels = c("House",
"Apartment",
"Mobile home",
"Other type of housing",
"No housing (homeless)"))
df$housingPaymentBaseline <- factor(df$housingPaymentBaseline,
levels = c("Owned free and clear",
"Owned with a mortgage or loan (including home equity loans)",
"Rented",
"Occupied without payment of rent"))
df$housingRentBaseline <- factor(df$housingRentBaseline,
levels = c("Yes",
"No",
"Payment was deferred"))
df$foodSecurity1Baseline <- factor(df$foodSecurity1Baseline,
levels = c("Enough of the kinds of food (I/we) wanted to eat",
"Enough, but not always the kinds of food (I/we) wanted to eat",
"Sometimes not enough to eat",
"Often not enough to eat"))
df$foodSecurity3Baseline <- factor(df$foodSecurity3Baseline,
levels = c("Yes",
"No",
"Payment was deferred"))
df$foodSecurity4Baseline <- factor(df$foodSecurity4Baseline,
level = c("Not at all confident",
"Somewhat confident",
"Moderately confident",
"Very confident"))
df$healthBaseline <- factor(df$healthBaseline,
levels = c("Excellent",
"Very good",
"Good",
"Fair",
"Poor"))
df$workStatus <- factor(df$workStatus,
level = c("In paid work (employee, self-employed, working for your family business)",
"In school, even if on vacation",
"Unemployed and actively looking for a job",
"Unemployed and not actively looking for a job",
"Permanently sick or disabled",
"Retired",
"In military service",
"In community service",
"Doing unpaid housework, looking after children or other persons",
"Other (please specify)"))
df$unemploymentBeneBaseline <- factor(df$unemploymentBeneBaseline,
levels = c("Yes",
"No"))
df$caresStimulusBaseline <- factor(df$caresStimulusBaseline,
levels = c("Yes",
"No"))
workLocationBaseline <- factor(df$workLocationBaseline,
levels = c("I work from home",
"I go to a location to work, such as an office, store, or work site",
"Other"))
df$nervousBaseline <- factor(df$nervousBaseline,
levels = c("All of the time",
"Most of the time",
"Some of the time",
"A little of the time",
"None of the time"))
df$delayCareBaseline <- factor(df$delayCareBaseline,
levels = c("Yes",
"No"))
df$avoidCareBaseline <- factor(df$avoidCareBaseline,
levels = c("Yes",
"No"))
df$educationBaseline <- factor(df$educationBaseline,
levels = c("Classes normally taught in person at the school were cancelled",
"Classes normally taught in person were moved to a distance-learning format using online resources, either self-paced or in real time",
"Classes normally taught in person were moved to a distance-learning format using paper materials sent home to children",
"Classes normally taught in person were changed in some other way -- Please specify:",
"There was no change because schools did not close"))
df$internetBaseline <- factor(df$internetBaseline,
levels = c("Always available",
"Usually available",
"Sometimes available",
"Rarely available",
"Never available"))
df$connectionHc <- factor(df$connectionHc,
levels = c("I feel an extremely close connection",
"I feel a very close connection",
"I feel a moderately close connection",
"I feel a weak connection",
"I do not feel a connection at all"))
df$outsider <- factor(df$outsider,
levels = c("Never",
"Rarely",
"Sometimes",
"Often",
"Always"))
df$polUnderstanding <- factor(df$polUnderstanding,
levels = c("Never",
"Once a year",
"Once a month",
"Once a week",
"Almost every day"))
df$polDiscuss <- factor(df$polDiscuss,
levels = c("Never",
"Once a year",
"Once a month",
"Once a week",
"Almost every day"))
df$dinner <- factor(df$dinner,
levels = c("Never",
"Once a year",
"Once a month",
"Once a week",
"Almost every day"))
df$contactsInUs <- factor(df$contactsInUs,
levels = c("0",
"1 to 2",
"3 to 6",
"7 to 14",
"15 or more"))
df$read <- factor(df$read,
levels = c("Not well at all",
"Not well",
"Moderately well",
"Well",
"Very well"))
df$speak <- factor(df$speak,
levels = c("Not well at all",
"Not well",
"Moderately well",
"Well",
"Very well"))
df$seeDoctor <- factor(df$seeDoctor,
levels = c("Very difficult",
"Somewhat difficult",
"Neither difficult, nor easy",
"Somewhat easy",
"Very easy"))
df$searchJob <- factor(df$searchJob,
levels = c("Very difficult",
"Somewhat difficult",
"Neither difficult, nor easy",
"Somewhat easy",
"Very easy"))