-
Notifications
You must be signed in to change notification settings - Fork 8
/
load_inputs.R
61 lines (42 loc) · 2.35 KB
/
load_inputs.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
# questionnaire
questions <- read.csv("input/kobo_questions.csv",
stringsAsFactors=F, check.names=F)
choices <- read.csv("input/kobo_choices.csv",
stringsAsFactors=F, check.names=F)
# sampling
cluster_lookup_table <- read.csv("input/combined_sample_ids.csv",
stringsAsFactors=F, check.names=F)
lookup_table <- read.csv("input/lookup_table_names.csv", stringsAsFactors = F)
samplingframe <- load_samplingframe("./input/strata_population.csv")
samplingframe_in_camp<-load_samplingframe("./input/sampling_frame_in_camp.csv")
# data
response <- read.csv("input/parent_merged.csv",
stringsAsFactors = F, check.names = F)
loop <- read.csv("input/loop_merged.csv", stringsAsFactors = F)
idp_in_camp <- read.csv("input/idp_in_camp.csv",
stringsAsFactors = F, check.names = F)
idp_in_camp$district <- to_alphanumeric_lowercase(samplingframe_in_camp$district.new[match(idp_in_camp$camp, samplingframe_in_camp$camp)])
loop_in_camp <- read.csv("input/loop_in_camp_v2.csv", stringsAsFactors = F)
# simple random strata
simple_random_strata<-matrix(c("Al-Baaj","idp_out_camp",
"Al-Hamdaniya","idp_out_camp",
"Al-Kaim","idp_out_camp",
"Al-Ramadi","idp_out_camp",
"Baladruz","idp_out_camp",
"Beygee","idp_out_camp",
"Daquq","idp_out_camp",
"Dibis","idp_out_camp",
"Al-Mussyab","returnee",
"Al-Rutba","returnee",
"Al-Shikhan","returnee",
"Dibis","returnee",
"Samarra","returnee",
"Al-Adhamiya","host",
"Al-Basrah","host",
"Al-Kahla","host",
"Al-Najaf","host",
"Al-Nasiriya","host",
"Al-Shirqat","host",
"Erbil","host"),ncol = 2,byrow = T)
simple_random_strata[,1]<-to_alphanumeric_lowercase(simple_random_strata[,1])
simple_random_strata<-paste0(simple_random_strata[,1],simple_random_strata[,2])