rm(list=ls(all=t))
filename <- "Section_7" # !!!Update filename
functions_vers <- "functions_1.8.R" # !!!Update helper functions file
source (functions_vers)
Visually inspect variables in "dictionary.csv" and flag for risk, using the following flags:
# Direct PII: Respondent Names, Addresses, Identification Numbers, Phone Numbers
# Direct PII-team: Interviewer Names, other field team names
# Indirect PII-ordinal: Date of birth, Age, income, education, household composition.
# Indirect PII-categorical: Gender, education, ethnicity, nationality,
# occupation, employer, head of household, marital status
# GPS: Longitude, Latitude
# Small Location: Location (<100,000)
# Large Location (>100,000)
# Weight: weightVar
# Household ID: hhId,
# Open-ends: Review responses for any sensitive information, redact as necessary
# !!!No Direct PII
# !!!No Direct PII-team
# !!!No Small Locations
# Focus on variables with a "Lowest Freq" in dictionary of 30 or less.
percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s7q3)[na.exclude(mydata$eh_s7q3)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s7q3", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s7q3. Q314: How much cash did you receive in the last 12 months? Magkano ang perang i
## -998 0 2 23 100 111 1000 1700 1780 2000 2200 2280 2600 2800 2900 3000 3200 3400 3600
## 15 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 3 1 2
## 3800 4000 4200 4300 4700 4800 5000 5200 5400 5600 6000 6100 6200 6400 6600 6800 7100 7200 7400
## 3 1 5 1 1 6 4 3 3 1 7 1 2 5 3 1 1 6 3
## 7600 7700 7800 7900 8000 8300 8400 8500 8600 8800 9000 9007 9100 9200 9300 9400 9500 9502 9600
## 1 1 3 2 4 1 3 1 2 8 12 1 1 3 2 3 1 1 11
## 9604 9700 9760 9800 10000 10100 10200 10400 10500 10600 10700 10800 11000 11100 11200 11300 11400 11500 11600
## 1 2 1 2 5 1 6 1 3 6 2 11 6 1 8 1 6 1 8
## 11700 11800 11900 12000 12200 12300 12400 12500 12600 12700 12800 13000 13100 13200 13300 13400 13500 13600 13700
## 2 3 2 34 8 2 5 3 8 2 16 9 1 47 2 3 3 11 1
## 13800 13920 14000 14080 14100 14200 14300 14400 14470 14500 14600 14700 14800 14900 15000 15200 15400 15500 15600
## 13 1 21 1 2 10 1 28 1 2 7 3 6 1 23 16 6 2 33
## 15700 15800 15900 16000 16100 16200 16300 16400 16600 16700 16800 16900 17000 17100 17200 17400 17500 17600 17700
## 1 5 2 24 3 16 3 23 5 5 71 1 34 2 13 10 7 18 4
## 17800 17900 18000 18020 18200 18300 18400 18500 18520 18540 18600 18700 18800 18900 19000 19100 19180 19200 19220
## 13 1 37 1 26 2 14 2 1 1 8 5 15 4 21 3 1 93 1
## 19300 19400 19500 19600 19680 19700 19800 19900 20000 20100 20200 20300 20400 20500 20600 20800 20900 21000 21020
## 2 2 7 9 1 2 16 2 21 2 8 4 36 6 12 10 1 27 1
## 21100 21200 21300 21400 21450 21600 21700 21800 21900 22000 22100 22200 22300 22400 22500 22600 22700 22800 22900
## 2 29 3 12 1 22 2 15 2 29 3 15 2 7 3 9 2 72 3
## 23000 23020 23100 23110 23180 23200 23300 23400 23500 23540 23600 23700 23800 23900 24000 24100 24200 24300 24400
## 21 1 3 1 1 22 1 7 4 1 7 4 9 2 28 1 17 1 7
## 24600 24610 24700 24800 24900 25000 25200 25300 25400 25500 25600 25700 25800 25900 26000 26020 26100 26200 26300
## 7 1 3 11 3 7 52 3 8 1 5 3 6 1 6 3 1 16 1
## 26400 26600 26700 26800 27000 27100 27200 27300 27400 27600 27800 27900 28000 28100 28200 28300 28400 28500 28600
## 34 10 2 7 2 1 6 1 3 11 2 1 8 2 9 1 7 2 4
## 28800 29000 29100 29200 29400 29600 30000 30400 30800 31000 31100 31200 31400 31800 32000 32400 33000 33100 33200
## 42 2 1 3 1 2 2 1 1 5 1 11 2 1 2 2 1 1 1
## 33600 34000 34200 35000 35800 36000 39000 41000 41600 45600 <NA>
## 4 3 1 1 1 3 1 1 1 1 335
## [1] "Frequency table after encoding"
## eh_s7q3. Q314: How much cash did you receive in the last 12 months? Magkano ang perang i
## -998 0 2 23 100 111 1000 1700
## 15 1 1 1 1 2 1 1
## 1780 2000 2200 2280 2600 2800 2900 3000
## 1 1 2 1 1 1 1 1
## 3200 3400 3600 3800 4000 4200 4300 4700
## 3 1 2 3 1 5 1 1
## 4800 5000 5200 5400 5600 6000 6100 6200
## 6 4 3 3 1 7 1 2
## 6400 6600 6800 7100 7200 7400 7600 7700
## 5 3 1 1 6 3 1 1
## 7800 7900 8000 8300 8400 8500 8600 8800
## 3 2 4 1 3 1 2 8
## 9000 9007 9100 9200 9300 9400 9500 9502
## 12 1 1 3 2 3 1 1
## 9600 9604 9700 9760 9800 10000 10100 10200
## 11 1 2 1 2 5 1 6
## 10400 10500 10600 10700 10800 11000 11100 11200
## 1 3 6 2 11 6 1 8
## 11300 11400 11500 11600 11700 11800 11900 12000
## 1 6 1 8 2 3 2 34
## 12200 12300 12400 12500 12600 12700 12800 13000
## 8 2 5 3 8 2 16 9
## 13100 13200 13300 13400 13500 13600 13700 13800
## 1 47 2 3 3 11 1 13
## 13920 14000 14080 14100 14200 14300 14400 14470
## 1 21 1 2 10 1 28 1
## 14500 14600 14700 14800 14900 15000 15200 15400
## 2 7 3 6 1 23 16 6
## 15500 15600 15700 15800 15900 16000 16100 16200
## 2 33 1 5 2 24 3 16
## 16300 16400 16600 16700 16800 16900 17000 17100
## 3 23 5 5 71 1 34 2
## 17200 17400 17500 17600 17700 17800 17900 18000
## 13 10 7 18 4 13 1 37
## 18020 18200 18300 18400 18500 18520 18540 18600
## 1 26 2 14 2 1 1 8
## 18700 18800 18900 19000 19100 19180 19200 19220
## 5 15 4 21 3 1 93 1
## 19300 19400 19500 19600 19680 19700 19800 19900
## 2 2 7 9 1 2 16 2
## 20000 20100 20200 20300 20400 20500 20600 20800
## 21 2 8 4 36 6 12 10
## 20900 21000 21020 21100 21200 21300 21400 21450
## 1 27 1 2 29 3 12 1
## 21600 21700 21800 21900 22000 22100 22200 22300
## 22 2 15 2 29 3 15 2
## 22400 22500 22600 22700 22800 22900 23000 23020
## 7 3 9 2 72 3 21 1
## 23100 23110 23180 23200 23300 23400 23500 23540
## 3 1 1 22 1 7 4 1
## 23600 23700 23800 23900 24000 24100 24200 24300
## 7 4 9 2 28 1 17 1
## 24400 24600 24610 24700 24800 24900 25000 25200
## 7 7 1 3 11 3 7 52
## 25300 25400 25500 25600 25700 25800 25900 26000
## 3 8 1 5 3 6 1 6
## 26020 26100 26200 26300 26400 26600 26700 26800
## 3 1 16 1 34 10 2 7
## 27000 27100 27200 27300 27400 27600 27800 27900
## 2 1 6 1 3 11 2 1
## 28000 28100 28200 28300 28400 28500 28600 28800
## 8 2 9 1 7 2 4 42
## 29000 29100 29200 29400 29600 30000 30400 30800
## 2 1 3 1 2 2 1 1
## 31000 31100 31200 31400 31800 32000 32400 33000
## 5 1 11 2 1 2 2 1
## 33100 33200 33600 34000 34048 or more <NA>
## 1 1 4 3 10 335
percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s7q4)[na.exclude(mydata$eh_s7q4)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s7q4", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s7q4. Q315: What was the total value of the in kind transfers received in the last 12
## 0 100 150 157 200 220 250 280 300 350 400 500 600 1000 1200 3100 3600 4800 5200
## 4 2 2 1 6 1 3 1 31 3 2 15 1 2 6 1 1 1 1
## 6000 7200 20000 <NA>
## 1 1 2 2200
## [1] "Frequency table after encoding"
## eh_s7q4. Q315: What was the total value of the in kind transfers received in the last 12
## 0 100 150 157 200 220 250 280
## 4 2 2 1 6 1 3 1
## 300 350 400 500 600 1000 1200 3100
## 31 3 2 15 1 2 6 1
## 3600 4800 5200 6000 7200 20000 or more <NA>
## 1 1 1 1 1 2 2200
percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s7q9)[na.exclude(mydata$eh_s7q9)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s7q9", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s7q9. What was the amount provided for the group livelihood? If benefits were received
## 1000 2300 2720 3000 5000 7000 9500 10000 14000 16000 20000 28600 30000 40000 50000 60000
## 1 1 1 1 2 1 1 7 1 1 2 1 2 1 1 2
## 65000 66000 70000 1e+05 190000 190500 260000 <NA>
## 1 1 2 2 1 1 1 2253
## [1] "Frequency table after encoding"
## eh_s7q9. What was the amount provided for the group livelihood? If benefits were received
## 1000 2300 2720 3000 5000 7000 9500
## 1 1 1 1 2 1 1
## 10000 14000 16000 20000 28600 30000 40000
## 7 1 1 2 1 2 1
## 50000 60000 65000 66000 70000 1e+05 190000
## 1 2 1 1 2 2 1
## 190500 248184 or more <NA>
## 1 1 2253
percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s7q10)[na.exclude(mydata$eh_s7q10)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s7q10", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s7q10. How many beneficiaries are part of this group? Ilan ang mga benepisyaryo na kas
## -998 1 2 3 5 6 7 10 12 13 14 15 19 26 28 30 42 <NA>
## 1 2 1 1 1 2 1 9 5 2 4 1 1 1 1 1 1 2253
## [1] "Frequency table after encoding"
## eh_s7q10. How many beneficiaries are part of this group? Ilan ang mga benepisyaryo na kas
## -998 1 2 3 5 6 7 10 12 13
## 1 2 1 1 1 2 1 9 5 2
## 14 15 19 26 28 30 39 or more <NA>
## 4 1 1 1 1 1 1 2253
percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s7q11)[na.exclude(mydata$eh_s7q11)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s7q11", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s7q11. What was the value of the benefits provided? If benefits were received in-kind,
## -998 0 100 105 150 200 300 500 700 1000 1375 1500 1900 2000 2020 2400 2700 2720 3000
## 2 2 1 1 1 1 3 1 1 1 1 2 1 3 1 1 7 1 2
## 3025 3100 4000 5000 7000 8000 8400 8500 9500 10000 12000 14000 16000 18000 19000 20000 20900 25000 30000
## 1 1 1 18 2 5 1 1 1 29 1 1 1 1 1 5 1 2 6
## 50000 <NA>
## 1 2175
## [1] "Frequency table after encoding"
## eh_s7q11. What was the value of the benefits provided? If benefits were received in-kind,
## -998 0 100 105 150 200 300 500
## 2 2 1 1 1 1 3 1
## 700 1000 1375 1500 1900 2000 2020 2400
## 1 1 1 2 1 3 1 1
## 2700 2720 3000 3025 3100 4000 5000 7000
## 7 1 2 1 1 1 18 2
## 8000 8400 8500 9500 10000 12000 14000 16000
## 5 1 1 1 29 1 1 1
## 18000 19000 20000 20900 25000 30000 38799 or more <NA>
## 1 1 5 1 2 6 1 2175
percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s7q13)[na.exclude(mydata$eh_s7q13)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s7q13", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s7q13. Q322: How much money in pesos did your household receive in the past 12 months f
## -998 900 1200 1500 3700 6000 8000 10200 10800 13500 17600 19600 20000 24000 26000 26400 28800 30000 32400
## 1 1 1 1 1 1 1 1 1 1 2 1 3 3 1 3 1 4 1
## 33000 36000 39600 40000 40800 42000 48000 54000 64800 <NA>
## 1 2 2 1 1 3 2 1 1 2245
## [1] "Frequency table after encoding"
## eh_s7q13. Q322: How much money in pesos did your household receive in the past 12 months f
## -998 900 1200 1500 3700 6000 8000 10200
## 1 1 1 1 1 1 1 1
## 10800 13500 17600 19600 20000 24000 26000 26400
## 1 1 2 1 3 3 1 3
## 28800 30000 32400 33000 36000 39600 40000 40800
## 1 4 1 1 2 2 1 1
## 42000 48000 54000 62531 or more <NA>
## 3 2 1 1 2245
percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s7q15)[na.exclude(mydata$eh_s7q15)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s7q15", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s7q15. Q324: What was the value of the in-kind transfer you received? Magkano po ang h
## -998 0 500 700 1000 2000 2500 2600 2700 3000 3300 3500 4000 5000 6000 6300 6500 6650 7000
## 4 24 1 1 1 3 1 1 1 6 1 1 3 20 12 1 2 1 22
## 7450 7500 7600 7700 8000 8400 8500 9000 9400 9500 9600 9800 9820 9902 9950 9959 10000 10200 10500
## 1 4 1 2 27 1 3 15 1 4 1 1 1 1 1 1 499 1 1
## 11500 12000 14000 15000 18000 20000 50000 <NA>
## 1 9 2 2 1 1 1 1599
## [1] "Frequency table after encoding"
## eh_s7q15. Q324: What was the value of the in-kind transfer you received? Magkano po ang h
## -998 0 500 700 1000 2000 2500 2600
## 4 24 1 1 1 3 1 1
## 2700 3000 3300 3500 4000 5000 6000 6300
## 1 6 1 1 3 20 12 1
## 6500 6650 7000 7450 7500 7600 7700 8000
## 2 1 22 1 4 1 2 27
## 8400 8500 9000 9400 9500 9600 9800 9820
## 1 3 15 1 4 1 1 1
## 9902 9950 9959 10000 10200 10500 11500 12000
## 1 1 1 499 1 1 1 9
## 14000 15000 or more <NA>
## 2 5 1599
percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s7q28)[na.exclude(mydata$eh_s7q28)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s7q28", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s7q28. Q338: How much did your household receive in benefits in the last 12 months? Ma
## 0 200 1500 2000 2200 2500 2800 4000 5000 7000 9000 10000 11000 13000 15000 16000
## 1 1 1 2 1 1 1 1 5 1 1 4 2 1 2 1
## 17000 20000 21700 25400 30000 80000 88000 187200 <NA>
## 1 1 1 1 1 1 1 1 2254
## [1] "Frequency table after encoding"
## eh_s7q28. Q338: How much did your household receive in benefits in the last 12 months? Ma
## 0 200 1500 2000 2200 2500 2800
## 1 1 1 2 1 1 1
## 4000 5000 7000 9000 10000 11000 13000
## 1 5 1 1 4 2 1
## 15000 16000 17000 20000 21700 25400 30000
## 2 1 1 1 1 1 1
## 80000 88000 170832 or more <NA>
## 1 1 1 2254
percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s7q34)[na.exclude(mydata$eh_s7q34)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s7q34", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s7q34. Q342: How much did your household receive in total from the government or NGOs i
## -999 -998 0 1 92 100 140 149 150 160 171 200 235 250 270 300
## 12 10 1570 2 1 2 1 1 1 1 1 9 1 1 1 5
## 350 366 400 500 600 635 650 750 800 810 1000 1400 1500 1540 1700 1800
## 1 1 4 15 3 1 1 1 2 1 9 1 12 1 1 1
## 2000 2200 2300 2400 2500 2720 2800 2900 3000 3240 3330 3400 3500 3600 4000 4200
## 8 1 1 29 3 3 1 3 11 1 1 1 2 1 3 1
## 4500 4800 5000 5020 5400 5500 5684 6000 6400 6500 6600 6800 7000 7200 7400 7500
## 8 3 13 1 2 1 1 24 1 2 3 1 4 2 1 4
## 7600 7700 7800 7900 8400 8500 8800 9000 9200 9300 9400 9500 9600 9800 10000 10100
## 1 1 2 2 2 1 3 7 1 1 1 1 2 1 29 1
## 10200 10500 11000 11100 11200 11300 11800 11850 11990 12000 12200 12350 12500 12600 12800 13000
## 1 1 1 1 3 1 1 1 1 17 1 1 1 2 1 5
## 13200 13300 13350 13600 13800 14000 14200 14400 14500 14600 14700 14800 15000 15150 15200 15400
## 6 1 1 2 3 3 2 4 1 1 1 2 7 1 3 2
## 15600 16000 16200 16400 16700 16800 16950 17000 17100 17200 17300 17400 17500 17600 17800 17850
## 2 10 4 5 1 1 1 7 3 2 1 2 1 2 2 1
## 17900 18000 18100 18200 18600 18700 18800 18900 19000 19040 19180 19200 19400 19500 19700 19800
## 1 6 1 3 3 1 3 1 2 1 1 6 1 1 2 1
## 19900 20000 20100 20200 20300 20400 20500 20550 20600 20700 20800 21000 21200 21300 21400 21500
## 2 7 2 1 1 2 1 1 1 1 1 4 4 2 3 1
## 21800 21920 22000 22200 22400 22500 22600 22800 22900 23000 23150 23200 23220 23300 23400 23600
## 2 1 5 2 2 3 2 8 2 2 2 4 1 1 1 3
## 23800 23900 24000 24400 24600 24650 24900 25000 25200 25400 25600 25900 26000 26240 26300 26400
## 1 1 4 2 2 1 2 14 2 3 1 1 5 1 1 7
## 26600 26780 26800 26900 27000 27200 27400 27600 27800 28000 28200 28350 28400 28425 28600 28800
## 2 1 2 1 2 2 3 1 1 3 4 1 1 1 2 3
## 29000 29200 29400 29700 29740 29800 29900 30000 30400 30800 30900 31000 31010 31100 31200 31500
## 1 3 1 1 1 1 1 30 1 1 1 1 1 1 3 1
## 31800 32000 32600 32800 32900 33200 33300 33600 34000 34200 34400 35000 35200 35400 36000 36400
## 1 3 1 3 1 2 1 1 2 2 1 3 1 1 1 2
## 36600 37600 37800 38600 39200 39600 40000 41000 44400 44900 46000 46800 50000 50800 52300 52800
## 1 1 1 1 2 1 1 1 2 1 1 1 3 1 1 1
## 54000 54300 55000 56100 59350 70000 73200 77339 85000 104400 300600
## 1 1 1 1 1 1 1 1 1 1 1
## [1] "Frequency table after encoding"
## eh_s7q34. Q342: How much did your household receive in total from the government or NGOs i
## -999 -998 0 1 92 100 140 149
## 12 10 1570 2 1 2 1 1
## 150 160 171 200 235 250 270 300
## 1 1 1 9 1 1 1 5
## 350 366 400 500 600 635 650 750
## 1 1 4 15 3 1 1 1
## 800 810 1000 1400 1500 1540 1700 1800
## 2 1 9 1 12 1 1 1
## 2000 2200 2300 2400 2500 2720 2800 2900
## 8 1 1 29 3 3 1 3
## 3000 3240 3330 3400 3500 3600 4000 4200
## 11 1 1 1 2 1 3 1
## 4500 4800 5000 5020 5400 5500 5684 6000
## 8 3 13 1 2 1 1 24
## 6400 6500 6600 6800 7000 7200 7400 7500
## 1 2 3 1 4 2 1 4
## 7600 7700 7800 7900 8400 8500 8800 9000
## 1 1 2 2 2 1 3 7
## 9200 9300 9400 9500 9600 9800 10000 10100
## 1 1 1 1 2 1 29 1
## 10200 10500 11000 11100 11200 11300 11800 11850
## 1 1 1 1 3 1 1 1
## 11990 12000 12200 12350 12500 12600 12800 13000
## 1 17 1 1 1 2 1 5
## 13200 13300 13350 13600 13800 14000 14200 14400
## 6 1 1 2 3 3 2 4
## 14500 14600 14700 14800 15000 15150 15200 15400
## 1 1 1 2 7 1 3 2
## 15600 16000 16200 16400 16700 16800 16950 17000
## 2 10 4 5 1 1 1 7
## 17100 17200 17300 17400 17500 17600 17800 17850
## 3 2 1 2 1 2 2 1
## 17900 18000 18100 18200 18600 18700 18800 18900
## 1 6 1 3 3 1 3 1
## 19000 19040 19180 19200 19400 19500 19700 19800
## 2 1 1 6 1 1 2 1
## 19900 20000 20100 20200 20300 20400 20500 20550
## 2 7 2 1 1 2 1 1
## 20600 20700 20800 21000 21200 21300 21400 21500
## 1 1 1 4 4 2 3 1
## 21800 21920 22000 22200 22400 22500 22600 22800
## 2 1 5 2 2 3 2 8
## 22900 23000 23150 23200 23220 23300 23400 23600
## 2 2 2 4 1 1 1 3
## 23800 23900 24000 24400 24600 24650 24900 25000
## 1 1 4 2 2 1 2 14
## 25200 25400 25600 25900 26000 26240 26300 26400
## 2 3 1 1 5 1 1 7
## 26600 26780 26800 26900 27000 27200 27400 27600
## 2 1 2 1 2 2 3 1
## 27800 28000 28200 28350 28400 28425 28600 28800
## 1 3 4 1 1 1 2 3
## 29000 29200 29400 29700 29740 29800 29900 30000
## 1 3 1 1 1 1 1 30
## 30400 30800 30900 31000 31010 31100 31200 31500
## 1 1 1 1 1 1 3 1
## 31800 32000 32600 32800 32900 33200 33300 33600
## 1 3 1 3 1 2 1 1
## 34000 34200 34400 35000 35200 35400 36000 36400
## 2 2 1 3 1 1 1 2
## 36600 37600 37800 38600 39200 39600 40000 41000
## 1 1 1 1 2 1 1 1
## 44400 44900 46000 46800 50000 50800 52300 52582 or more
## 2 1 1 1 3 1 1 12
# !!!Include relevant variables in list below (Indirect PII - Categorical, and Ordinal if not processed yet)
indirect_PII <- c("eh_s7q16")
capture_tables (indirect_PII)
break_inkind <- c(-999,-998,1,2,3,4,5,99)
labels_inkind <- c("Refused to answer" =1,
"Don't know" =2,
"Sari Sari business/equipment" =3,
"Prepared-Food business/equipment (rice, vegetables, fish, etc)" =4,
"Fishing business/equipment" =5,
"Merienda/ streetfood business/equipment" =6,
"Other" = 7,
"Other business/assets - specify"=8)
mydata <- ordinal_recode (variable="eh_s7q16", break_points=break_inkind, missing=999999, value_labels=labels_inkind)
## [1] "Frequency table before encoding"
## eh_s7q16. Q325: Please describe the in-kind transfer Pakilarawan ang ibinigay sa inyong h
## Sari Sari business/equipment
## 292
## Prepared-Food business/equipment (rice, vegetables, fish, etc)
## 130
## Fishing business/equipment
## 65
## Merienda/ streetfood business/equipment
## 62
## Welding business/equipment
## 4
## Carpentry business/equipment
## 15
## Product manufacturing business/equipment
## 2
## Beauty care business/equipment
## 3
## Vulcanizing business/equipment
## 2
## Livestock raising business/equipment
## 20
## Poultry raising business/equipment
## 4
## Dry good business/equipment
## 8
## Tailoring business/equipment
## 11
## Automotive business/equipment
## 1
## Farming or farming-support business/equipment
## 18
## Vehicle driving business/equipment
## 16
## Masonry or construction business/equipment
## 4
## Other business/assets - specify
## 32
## <NA>
## 1599
## recoded
## [-999,-998) [-998,1) [1,2) [2,3) [3,4) [4,5) [5,99) [99,1e+06)
## 1 0 0 292 0 0 0 0 0
## 2 0 0 0 130 0 0 0 0
## 3 0 0 0 0 65 0 0 0
## 4 0 0 0 0 0 62 0 0
## 5 0 0 0 0 0 0 4 0
## 6 0 0 0 0 0 0 15 0
## 7 0 0 0 0 0 0 2 0
## 8 0 0 0 0 0 0 3 0
## 9 0 0 0 0 0 0 2 0
## 10 0 0 0 0 0 0 20 0
## 11 0 0 0 0 0 0 4 0
## 12 0 0 0 0 0 0 8 0
## 13 0 0 0 0 0 0 11 0
## 14 0 0 0 0 0 0 1 0
## 15 0 0 0 0 0 0 18 0
## 16 0 0 0 0 0 0 16 0
## 17 0 0 0 0 0 0 4 0
## 99 0 0 0 0 0 0 0 32
## [1] "Frequency table after encoding"
## eh_s7q16. Q325: Please describe the in-kind transfer Pakilarawan ang ibinigay sa inyong h
## Sari Sari business/equipment
## 292
## Prepared-Food business/equipment (rice, vegetables, fish, etc)
## 130
## Fishing business/equipment
## 65
## Merienda/ streetfood business/equipment
## 62
## Other
## 108
## Other business/assets - specify
## 32
## <NA>
## 1599
## [1] "Inspect value labels and relabel as necessary"
## Refused to answer
## 1
## Don't know
## 2
## Sari Sari business/equipment
## 3
## Prepared-Food business/equipment (rice, vegetables, fish, etc)
## 4
## Fishing business/equipment
## 5
## Merienda/ streetfood business/equipment
## 6
## Other
## 7
## Other business/assets - specify
## 8
# !!!Insufficient demographic data
# !!! Identify open-end variables here:
open_ends <- c("eh_s7q17",
"eh_s7q26",
"eh_s7q33",
"eh_s7q36")
report_open (list_open_ends = open_ends)
# Review "verbatims.csv". Identify variables to be deleted or redacted and their row number
mydata$eh_s7q17[157] <- "[Other business/assets]"
mydata$eh_s7q17[260] <- "[Other business/assets]"
mydata$eh_s7q17[265] <- "[Other business/assets]"
mydata$eh_s7q17[281] <- "[Other business/assets]"
mydata$eh_s7q17[330] <- "[Other business/assets]"
mydata$eh_s7q17[429] <- "[Other business/assets]"
mydata$eh_s7q17[493] <- "[Other business/assets]"
mydata$eh_s7q17[563] <- "[Other business/assets]"
mydata$eh_s7q17[592] <- "[Other business/assets]"
mydata$eh_s7q17[664] <- "[Other business/assets]"
mydata$eh_s7q17[720] <- "[Other business/assets]"
mydata$eh_s7q17[774] <- "[Other business/assets]"
mydata$eh_s7q17[824] <- "[Other business/assets]"
mydata$eh_s7q17[913] <- "[Other business/assets]"
mydata$eh_s7q17[1043] <- "[Other business/assets]"
mydata$eh_s7q17[1061] <- "[Other business/assets]"
mydata$eh_s7q17[1096] <- "[Other business/assets]"
mydata$eh_s7q17[1255] <- "[Other business/assets]"
mydata$eh_s7q17[1262] <- "[Other business/assets]"
mydata$eh_s7q17[1269] <- "[Other business/assets]"
mydata$eh_s7q17[1296] <- "[Other business/assets]"
mydata$eh_s7q17[1371] <- "[Other business/assets]"
mydata$eh_s7q17[1373] <- "[Other business/assets]"
mydata$eh_s7q17[1407] <- "[Other business/assets]"
mydata$eh_s7q17[1414] <- "[Other business/assets]"
mydata$eh_s7q17[1423] <- "[Other business/assets]"
mydata$eh_s7q17[1511] <- "[Other business/assets]"
mydata$eh_s7q17[2103] <- "[Other business/assets]"
mydata$eh_s7q17[2141] <- "[Other business/assets]"
mydata$eh_s7q17[2143] <- "[Other business/assets]"
mydata$eh_s7q17[2153] <- "[Other business/assets]"
mydata$eh_s7q17[2160] <- "[Other business/assets]"
mydata$eh_s7q26[1134] <- "The dole descided to give them groceries worth [amount redacted], instead they requested rice or pig feeds"
mydata$eh_s7q26[2141] <- "[language]"
mydata$eh_s7q33[78] <- "From mayor in [location]"
mydata$eh_s7q33[109] <- "Senior Citizen -[amount]"
mydata$eh_s7q33[285] <- "Philhealth - [amount]"
mydata$eh_s7q33[291] <- "[language]"
mydata$eh_s7q33[295] <- "[language]"
mydata$eh_s7q33[317] <- "Shelter assistance - [amount]"
mydata$eh_s7q33[328] <- "[language]"
mydata$eh_s7q33[345] <- "Redcross ( shelter assistance ) [amount]"
mydata$eh_s7q33[364] <- "[language]"
mydata$eh_s7q33[368] <- "[amount] pesos"
mydata$eh_s7q33[374] <- "[language]"
mydata$eh_s7q33[385] <- "Philhealth - [amount]"
mydata$eh_s7q33[403] <- "Green Ladies (Government of [name])"
mydata$eh_s7q33[430] <- "Philhealth - [amount]"
mydata$eh_s7q33[433] <- "[language]"
mydata$eh_s7q33[443] <- "Cash gift [amount]"
mydata$eh_s7q33[467] <- "From SSS, [amount] pension for senior citizen every 3 months."
mydata$eh_s7q33[500] <- "Given by governor [name]"
mydata$eh_s7q33[557] <- "Philhealth [amount]"
mydata$eh_s7q33[609] <- "From municipal of [name]"
mydata$eh_s7q33[674] <- "[amount]kilos of rice"
mydata$eh_s7q33[703] <- "[language]"
mydata$eh_s7q33[738] <- "[language]"
mydata$eh_s7q33[814] <- "[amount]"
mydata$eh_s7q33[858] <- "[language]"
mydata$eh_s7q33[886] <- "[language]"
mydata$eh_s7q33[944] <- "Dswd [amount] Donation [amount]"
mydata$eh_s7q33[1017] <- "Gift cheque worth [amount]"
mydata$eh_s7q33[1049] <- "[language]"
mydata$eh_s7q33[1084] <- "Senior Citizen pension [amount]"
mydata$eh_s7q33[1207] <- "Christmast gift of president duterte worth 2 [amount]"
mydata$eh_s7q33[1254] <- "Christmas gift Grocery worth [amount] from Gov. [name], and [name]"
mydata$eh_s7q33[1257] <- "Given [amount]k rice of Mayor"
mydata$eh_s7q33[1307] <- "From governor [name]([amount]) and christmas gift fr. Brgy.([amount])"
mydata$eh_s7q33[1345] <- "[amount] from other benefits other than dswd."
mydata$eh_s7q33[1368] <- "[amount]"
mydata$eh_s7q33[1534] <- "DSWD totally damaged houses -[amount] 5pcs galvanized sim [amount]"
mydata$eh_s7q33[1615] <- "River of life NGO - P[amount] DSWD housing - P[amount] DSWD relief goods - P[amount]"
mydata$eh_s7q33[1855] <- "PhilHealth for [name]"
mydata$eh_s7q33[1866] <- "Medicine [amount] from barangay center"
mydata$eh_s7q33[1899] <- "Philhealth [amount]"
mydata$eh_s7q33[2001] <- "Philhealth [amount] for hospital bills"
mydata$eh_s7q33[2065] <- "[name] [amount] and [amount]for house renovation"
mydata$eh_s7q33[2075] <- "[language]"
mydata$eh_s7q33[2097] <- "[language]"
mydata$eh_s7q33[2098] <- "[language]"
mydata$eh_s7q33[2132] <- "Relief [amount]p Senior citizen [amount]"
mydata$eh_s7q33[2148] <- "[amount] kilos of rice plus grocery items from the governor"
mydata$eh_s7q33[2149] <- "[amount] kilos of rice and grocery package from the barangay, could be worth [amount] pesos"
mydata$eh_s7q33[2174] <- "[amount] peso worth of relief from the governor"
mydata$eh_s7q33[2193] <- "Philhealth [amount]"
mydata$eh_s7q33[2273] <- "BANHI: [name]' Sponsorship"
mydata$eh_s7q36[275] <- "As per respondent, they already paid the whole [amount] in SLP and DSWD, and now they claiming the savings [amount]but the DSWD dont yet give back that said amount"
mydata$eh_s7q36[313] <- "Dole give them [amount] worthof items then [amount] cash"
mydata$eh_s7q36[1051] <- "The DOLE give [amount] for goat and [amount] for the rice"
mydata$eh_s7q36[1277] <- "Every 2 months the amount of money received is [amount] but the mother of the respondent is the direct beneficiary of 4P's. The amount of money declared here is the amount received by the children for the past 12 months."
mydata$eh_s7q36[1305] <- "She receive [amount] every 2 months for her 4ps."
mydata$eh_s7q36[1329] <- "The respondent get careless because of the activity of her child [name] and she don't have idea how much the income,and repeat the 1st activity twice and she just realize that she just start her business last week"
mydata$eh_s7q36[1516] <- "She received benefits from owwa because she is ex overseas worker([name])"
# !!!No GPS data
haven::write_dta(mydata, paste0(filename, "_PU.dta"))
haven::write_sav(mydata, paste0(filename, "_PU.sav"))
# Add report title dynamically
title_var <- paste0("DOL-ILAB SDC - ", filename)