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.
# Top code number of animals/products
quantile(na.exclude(mydata$s7q1)[na.exclude(mydata$s7q1)!=999999], probs = 0.995)
## 99.5%
## 4
mydata <- top_recode ("s7q1", break_point=4, missing=c(888, 999999))
## [1] "Frequency table before encoding"
## s7q1. How many large livestock (cows, bulls, calves, horses etc.) does your household
## 0 1 2 3 4 5 7 40 <NA>
## 2044 148 69 17 4 5 3 1 5
## [1] "Frequency table after encoding"
## s7q1. How many large livestock (cows, bulls, calves, horses etc.) does your household
## 0 1 2 3 4 or more <NA>
## 2044 148 69 17 13 5
quantile(na.exclude(mydata$s7q2)[na.exclude(mydata$s7q2)!=999999], probs = 0.995)
## 99.5%
## 1
mydata <- top_recode ("s7q2", break_point=1, missing=c(888, 999999))
## [1] "Frequency table before encoding"
## s7q2. How many large livestock (cows, bulls, calves, horses, etc.) does your household
## 0 1 2 3 4 6 8 <NA>
## 2258 22 5 1 1 1 3 5
## [1] "Frequency table after encoding"
## s7q2. How many large livestock (cows, bulls, calves, horses, etc.) does your household
## 0 1 or more <NA>
## 2258 33 5
quantile(na.exclude(mydata$s7q3)[na.exclude(mydata$s7q3)!=999999], probs = 0.995)
## 99.5%
## 6
mydata <- top_recode ("s7q3", break_point=6, missing=c(888, 999999))
## [1] "Frequency table before encoding"
## s7q3. How many large livestock does your household manage/take care of which it neithe
## 0 1 2 3 4 5 6 7 9 10 11 34 <NA>
## 2029 142 64 23 15 5 7 2 2 1 1 1 4
## [1] "Frequency table after encoding"
## s7q3. How many large livestock does your household manage/take care of which it neithe
## 0 1 2 3 4 5 6 or more <NA>
## 2029 142 64 23 15 5 14 4
quantile(na.exclude(mydata$s7q7)[na.exclude(mydata$s7q7)!=999999], probs = 0.995)
## 99.5%
## 2.235
mydata <- top_recode ("s7q7", break_point=2200, missing=c(888, 999999))
## [1] "Frequency table before encoding"
## s7q7. In the past 12 months, how many liters of milk did your large livestock produce?
## 0 3 20 2400 <NA>
## 449 1 1 1 1844
## [1] "Frequency table after encoding"
## s7q7. In the past 12 months, how many liters of milk did your large livestock produce?
## 0 3 20 2200 or more <NA>
## 449 1 1 1 1844
quantile(na.exclude(mydata$s7q15)[na.exclude(mydata$s7q15)!=999999], probs = 0.995)
## 99.5%
## 3
mydata <- top_recode ("s7q15", break_point=3, missing=c(888, 999999))
## [1] "Frequency table before encoding"
## s7q15. In the past 12 months, how many large livestock have you sold? Sa nakalipas na
## 0 1 2 3 <NA>
## 388 46 12 6 1844
## [1] "Frequency table after encoding"
## s7q15. In the past 12 months, how many large livestock have you sold? Sa nakalipas na
## 0 1 2 3 or more <NA>
## 388 46 12 6 1844
quantile(na.exclude(mydata$s7q17)[na.exclude(mydata$s7q17)!=999999], probs = 0.995)
## 99.5%
## 1
mydata <- top_recode ("s7q17", break_point=1, missing=c(888, 999999))
## [1] "Frequency table before encoding"
## s7q17. In the past 12 months how many large animals have you butchered? Sa nakalipas n
## 0 1 3 <NA>
## 447 4 1 1844
## [1] "Frequency table after encoding"
## s7q17. In the past 12 months how many large animals have you butchered? Sa nakalipas n
## 0 1 or more <NA>
## 447 5 1844
quantile(na.exclude(mydata$s7q20)[na.exclude(mydata$s7q20)!=999999], probs = 0.995)
## 99.5%
## 14.07
mydata <- top_recode ("s7q20", break_point=14, missing=c(888, 999999))
## [1] "Frequency table before encoding"
## s7q20. How many small livestock (goats, sheep, pigs, etc.) does your household own, mea
## 0 1 2 3 4 5 6 7 8 9 10 11 12 13 15 16 18 21 22 25 27 30
## 1933 150 81 41 20 12 14 7 10 2 3 1 3 5 4 2 1 1 1 1 1 1
## <NA>
## 2
## [1] "Frequency table after encoding"
## s7q20. How many small livestock (goats, sheep, pigs, etc.) does your household own, mea
## 0 1 2 3 4 5 6 7 8 9
## 1933 150 81 41 20 12 14 7 10 2
## 10 11 12 13 14 or more <NA>
## 3 1 3 5 12 2
quantile(na.exclude(mydata$s7q21)[na.exclude(mydata$s7q21)!=999999], probs = 0.995)
## 99.5%
## 2
mydata <- top_recode ("s7q21", break_point=2, missing=c(888, 999999))
## [1] "Frequency table before encoding"
## s7q21. How many small livestock (goats, sheep, pigs, etc.) does your household rent or
## 0 1 2 3 4 7 8 9 <NA>
## 2269 10 9 1 1 1 1 1 3
## [1] "Frequency table after encoding"
## s7q21. How many small livestock (goats, sheep, pigs, etc.) does your household rent or
## 0 1 2 or more <NA>
## 2269 10 14 3
quantile(na.exclude(mydata$s7q22)[na.exclude(mydata$s7q22)!=999999], probs = 0.995)
## 99.5%
## 10
mydata <- top_recode ("s7q22", break_point=10, missing=c(888, 999999))
## [1] "Frequency table before encoding"
## s7q22. How many small livestock (goats, sheep, pigs, etc.) does your household take car
## 0 1 2 3 4 5 6 7 8 9 10 11 13 16 19 24 27 29 30 <NA>
## 2133 60 44 14 7 6 7 2 3 3 3 4 1 1 1 1 1 1 1 3
## [1] "Frequency table after encoding"
## s7q22. How many small livestock (goats, sheep, pigs, etc.) does your household take car
## 0 1 2 3 4 5 6 7 8 9
## 2133 60 44 14 7 6 7 2 3 3
## 10 or more <NA>
## 14 3
quantile(na.exclude(mydata$s7q31)[na.exclude(mydata$s7q31)!=999999], probs = 0.995)
## 99.5%
## 19.61
mydata <- top_recode ("s7q31", break_point=19, missing=c(888, 999999))
## [1] "Frequency table before encoding"
## s7q31. In the past 12 months, how many small livestock have you sold? Sa nakalipas na
## 0 1 2 3 4 5 6 7 8 9 10 11 15 19 20 21 <NA>
## 305 68 41 24 5 4 9 8 3 2 3 1 2 1 2 1 1817
## [1] "Frequency table after encoding"
## s7q31. In the past 12 months, how many small livestock have you sold? Sa nakalipas na
## 0 1 2 3 4 5 6 7 8 9
## 305 68 41 24 5 4 9 8 3 2
## 10 11 15 19 or more <NA>
## 3 1 2 4 1817
quantile(na.exclude(mydata$s7q33)[na.exclude(mydata$s7q33)!=999999], probs = 0.995)
## 99.5%
## 8
mydata <- top_recode ("s7q33", break_point=8, missing=c(888, 999999))
## [1] "Frequency table before encoding"
## s7q33. In the past 12 months how many small livestocks have you butchered? Sa nakalipa
## 0 1 2 3 4 8 10 <NA>
## 408 47 9 8 2 3 2 1817
## [1] "Frequency table after encoding"
## s7q33. In the past 12 months how many small livestocks have you butchered? Sa nakalipa
## 0 1 2 3 4 8 or more <NA>
## 408 47 9 8 2 5 1817
quantile(na.exclude(mydata$s7q36)[na.exclude(mydata$s7q36)!=999999], probs = 0.995)
## 99.5%
## 59.54
mydata <- top_recode ("s7q36", break_point=59, missing=c(888, 999999))
## [1] "Frequency table before encoding"
## s7q36. How many birds (chicken, ducks, quail, roosters/fighting cocks, etc.) does your
## 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
## 1321 68 111 78 74 80 48 53 30 27 72 19 23 25 11 41 15 7 9 8 41 6
## 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 39 40 45 46 47 48
## 3 6 3 11 2 7 6 4 18 2 5 1 1 5 3 2 3 9 1 1 1 1
## 49 50 51 58 59 60 70 75 79 87 99 <NA>
## 1 14 2 1 1 2 5 1 1 1 2 3
## [1] "Frequency table after encoding"
## s7q36. How many birds (chicken, ducks, quail, roosters/fighting cocks, etc.) does your
## 0 1 2 3 4 5 6 7 8 9
## 1321 68 111 78 74 80 48 53 30 27
## 10 11 12 13 14 15 16 17 18 19
## 72 19 23 25 11 41 15 7 9 8
## 20 21 22 23 24 25 26 27 28 29
## 41 6 3 6 3 11 2 7 6 4
## 30 31 32 33 34 35 36 37 39 40
## 18 2 5 1 1 5 3 2 3 9
## 45 46 47 48 49 50 51 58 59 or more <NA>
## 1 1 1 1 1 14 2 1 13 3
quantile(na.exclude(mydata$s7q37)[na.exclude(mydata$s7q37)!=999999], probs = 0.995)
## 99.5%
## 5.54
mydata <- top_recode ("s7q37", break_point=5, missing=c(888, 999999))
## [1] "Frequency table before encoding"
## s7q37. How many birds (chicken, ducks, quail, roosters/fighting cocks, etc.) does your
## 0 1 2 3 4 5 6 7 8 13 20 26 30 <NA>
## 2266 3 2 4 2 4 4 2 2 1 1 1 1 3
## [1] "Frequency table after encoding"
## s7q37. How many birds (chicken, ducks, quail, roosters/fighting cocks, etc.) does your
## 0 1 2 3 4 5 or more <NA>
## 2266 3 2 4 2 16 3
quantile(na.exclude(mydata$s7q38)[na.exclude(mydata$s7q38)!=999999], probs = 0.995)
## 99.5%
## 16.09
mydata <- top_recode ("s7q38", break_point=1, missing=c(888, 999999))
## [1] "Frequency table before encoding"
## s7q38. How many birds (chicken, ducks, quail, roosters/fighting cocks, etc.) does your
## 0 1 2 3 4 5 6 7 8 10 11 12 13 14 15 17 20 22 24 29 30 36
## 2207 8 14 6 10 9 8 4 3 2 1 2 2 2 2 1 2 1 1 1 3 1
## 50 99 <NA>
## 1 1 4
## [1] "Frequency table after encoding"
## s7q38. How many birds (chicken, ducks, quail, roosters/fighting cocks, etc.) does your
## 0 1 or more <NA>
## 2207 85 4
quantile(na.exclude(mydata$s7q42)[na.exclude(mydata$s7q42)!=999999], probs = 0.995)
## 99.5%
## 2057.76
mydata <- top_recode ("s7q42", break_point=2000, missing=c(888, 999999))
## [1] "Frequency table before encoding"
## s7q42. In the past 12 months, how many eggs have your birds produced? Sa nakalipas na
## 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
## 277 5 13 7 7 8 13 12 16 13 50 4 28 8 13 9 6 8 8 1 44 4
## 22 24 25 26 27 28 29 30 32 33 35 36 38 39 40 42 43 44 45 46 48 49
## 3 15 8 7 1 3 4 40 7 1 4 12 3 1 25 4 1 1 5 1 5 1
## 50 52 54 56 60 62 63 64 65 66 69 70 72 75 80 84 90 96 100 103 120 126
## 52 4 1 2 33 1 2 2 2 2 1 4 4 1 3 1 9 2 38 1 15 1
## 128 144 150 160 168 180 186 192 200 208 216 225 237 240 252 272 288 300 320 322 360 480
## 2 4 6 3 1 1 1 2 12 1 1 1 1 5 1 1 4 4 1 1 3 1
## 486 500 576 624 720 984 1000 1800 2000 2304 2880 2936 3640 5000 <NA>
## 1 3 1 1 1 1 3 2 1 1 1 1 1 1 1333
## [1] "Frequency table after encoding"
## s7q42. In the past 12 months, how many eggs have your birds produced? Sa nakalipas na
## 0 1 2 3 4 5 6 7
## 277 5 13 7 7 8 13 12
## 8 9 10 11 12 13 14 15
## 16 13 50 4 28 8 13 9
## 16 17 18 19 20 21 22 24
## 6 8 8 1 44 4 3 15
## 25 26 27 28 29 30 32 33
## 8 7 1 3 4 40 7 1
## 35 36 38 39 40 42 43 44
## 4 12 3 1 25 4 1 1
## 45 46 48 49 50 52 54 56
## 5 1 5 1 52 4 1 2
## 60 62 63 64 65 66 69 70
## 33 1 2 2 2 2 1 4
## 72 75 80 84 90 96 100 103
## 4 1 3 1 9 2 38 1
## 120 126 128 144 150 160 168 180
## 15 1 2 4 6 3 1 1
## 186 192 200 208 216 225 237 240
## 1 2 12 1 1 1 1 5
## 252 272 288 300 320 322 360 480
## 1 1 4 4 1 1 3 1
## 486 500 576 624 720 984 1000 1800
## 1 3 1 1 1 1 3 2
## 2000 or more <NA>
## 6 1333
quantile(na.exclude(mydata$s7q46)[na.exclude(mydata$s7q46)!=999999], probs = 0.995)
## 99.5%
## 49.46
mydata <- top_recode ("s7q46", break_point=49, missing=c(888, 999999))
## [1] "Frequency table before encoding"
## s7q46. In the past 12 months, how many birds have you sold? Sa nakalipas na labindalaw
## 0 1 2 3 4 5 6 7 8 9 10 11 12 15 17 20 24 30
## 763 45 49 34 24 28 12 6 3 2 18 1 1 4 1 4 2 3
## 32 50 630 700 1500 2500 15000 <NA>
## 1 1 1 1 1 1 1 1289
## [1] "Frequency table after encoding"
## s7q46. In the past 12 months, how many birds have you sold? Sa nakalipas na labindalaw
## 0 1 2 3 4 5 6 7 8 9
## 763 45 49 34 24 28 12 6 3 2
## 10 11 12 15 17 20 24 30 32 49 or more
## 18 1 1 4 1 4 2 3 1 6
## <NA>
## 1289
quantile(na.exclude(mydata$s7q48)[na.exclude(mydata$s7q48)!=999999], probs = 0.995)
## 99.5%
## 48.04
mydata <- top_recode ("s7q48", break_point=48, missing=c(888, 999999))
## [1] "Frequency table before encoding"
## s7q48. In the past 12 months, how many birds of yours have you butchered for meat? It
## 0 1 2 3 4 5 6 7 8 9 10 11 12 13 15 16 20 21 22 24 25 30
## 429 68 75 65 48 77 32 18 9 4 88 1 6 1 16 3 19 1 1 6 3 13
## 34 36 40 48 50 52 <NA>
## 1 4 2 2 4 1 1299
## [1] "Frequency table after encoding"
## s7q48. In the past 12 months, how many birds of yours have you butchered for meat? It
## 0 1 2 3 4 5 6 7 8 9
## 429 68 75 65 48 77 32 18 9 4
## 10 11 12 13 15 16 20 21 22 24
## 88 1 6 1 16 3 19 1 1 6
## 25 30 34 36 40 48 or more <NA>
## 3 13 1 4 2 7 1299
# Top code high income/value/expenses to the 99.5 percentile
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q6)[na.exclude(mydata$s7q6)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q6", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q6. How much was this start-up capital? Magkano ang panimulang puhunan?
## 0 120 200 300 400 500 640 750 1000 1200 1500 2000 3300 4000 5000
## 8 1 2 2 1 1 1 1 1 1 1 1 1 1 4
## 6000 7000 8000 9000 9500 10000 12000 13000 14000 14480 14500 15000 16000 17000 18000
## 5 1 3 1 1 7 1 1 3 1 1 8 2 1 5
## 18700 20000 21000 22000 23000 24000 25000 27000 29000 30000 32000 35000 38000 38500 39000
## 1 8 1 3 2 1 3 1 2 3 2 2 1 1 2
## 40000 42000 44000 44500 51000 160000 <NA>
## 4 1 1 1 1 1 2186
## [1] "Frequency table after encoding"
## s7q6. How much was this start-up capital? Magkano ang panimulang puhunan?
## 0 120 200 300 400 500 640
## 8 1 2 2 1 1 1
## 750 1000 1200 1500 2000 3300 4000
## 1 1 1 1 1 1 1
## 5000 6000 7000 8000 9000 9500 10000
## 4 5 1 3 1 1 7
## 12000 13000 14000 14480 14500 15000 16000
## 1 1 3 1 1 8 2
## 17000 18000 18700 20000 21000 22000 23000
## 1 5 1 8 1 3 2
## 24000 25000 27000 29000 30000 32000 35000
## 1 3 1 2 3 2 2
## 38000 38500 39000 40000 42000 44000 44500
## 1 1 2 4 1 1 1
## 51000 100594 or more <NA>
## 1 1 2186
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q9)[na.exclude(mydata$s7q9)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q9", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q9. What was the total revenue receive from sales of this milk ? Magkano ang kabuua
## 0 60000 <NA>
## 2 1 2293
## [1] "Frequency table after encoding"
## s7q9. What was the total revenue receive from sales of this milk ? Magkano ang kabuua
## 0 59400 or more <NA>
## 2 1 2293
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q12)[na.exclude(mydata$s7q12)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q12", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q12. How much income have you received? Magkano ang iyong kita?
## 200 500 600 1000 1200 1400 1500 1800 2000 3000 3200 3600 4800 5000 6000 7000 7500 9000
## 2 4 2 3 2 1 1 1 4 8 1 1 2 3 2 1 1 1
## 10000 12600 15600 16000 20000 24000 30000 54000 <NA>
## 2 1 1 1 1 1 1 1 2247
## [1] "Frequency table after encoding"
## s7q12. How much income have you received? Magkano ang iyong kita?
## 200 500 600 1000 1200 1400 1500
## 2 4 2 3 2 1 1
## 1800 2000 3000 3200 3600 4800 5000
## 1 4 8 1 1 2 3
## 6000 7000 7500 9000 10000 12600 15600
## 2 1 1 1 2 1 1
## 16000 20000 24000 30000 48239 or more <NA>
## 1 1 1 1 1 2247
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q16)[na.exclude(mydata$s7q16)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q16", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q16. How much did you earn from these sales in total? Magkano ang kabuuang kita mo s
## 2500 3000 3500 4000 4500 5000 6000 7750 8000 8500 9000 9500 10000 10500 12000 12100 13000 14000
## 2 2 1 1 1 1 3 1 2 2 1 2 3 1 3 1 2 1
## 15000 16000 17000 18000 20000 22000 23000 24000 25000 27000 29000 30000 31000 32500 36000 38000 40000 43000
## 6 2 2 1 2 1 1 1 2 2 1 4 1 1 1 1 1 1
## 47000 48000 50000 <NA>
## 1 1 1 2232
## [1] "Frequency table after encoding"
## s7q16. How much did you earn from these sales in total? Magkano ang kabuuang kita mo s
## 2500 3000 3500 4000 4500 5000 6000
## 2 2 1 1 1 1 3
## 7750 8000 8500 9000 9500 10000 10500
## 1 2 2 1 2 3 1
## 12000 12100 13000 14000 15000 16000 17000
## 3 1 2 1 6 2 2
## 18000 20000 22000 23000 24000 25000 27000
## 1 2 1 1 1 2 2
## 29000 30000 31000 32500 36000 38000 40000
## 1 4 1 1 1 1 1
## 43000 47000 48000 49370 or more <NA>
## 1 1 1 1 2232
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q19)[na.exclude(mydata$s7q19)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q19", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q19. What was the total revenue from sales of this butchered meat? Magkano ang kabuu
## 0 2700 9000 15000 31000 <NA>
## 1 1 1 1 1 2291
## [1] "Frequency table after encoding"
## s7q19. What was the total revenue from sales of this butchered meat? Magkano ang kabuu
## 0 2700 9000 15000 30680 or more <NA>
## 1 1 1 1 1 2291
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q28)[na.exclude(mydata$s7q28)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q28", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q28. How much income? Magkano ang iyong kita?
## 300 600 800 1200 1500 1700 1800 2000 3000 3200 3500 3600 4000 4500 4900 5000 5500 6000
## 1 1 1 2 1 1 1 8 2 1 1 2 4 2 1 2 1 3
## 7500 9000 11000 12000 12200 13000 14000 14480 14500 18000 18500 20000 22000 30000 31500 90000 <NA>
## 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2245
## [1] "Frequency table after encoding"
## s7q28. How much income? Magkano ang iyong kita?
## 300 600 800 1200 1500 1700 1800
## 1 1 1 2 1 1 1
## 2000 3000 3200 3500 3600 4000 4500
## 8 2 1 1 2 4 2
## 4900 5000 5500 6000 7500 9000 11000
## 1 2 1 3 1 1 1
## 12000 12200 13000 14000 14480 14500 18000
## 1 1 1 1 1 1 1
## 18500 20000 22000 30000 31500 75375 or more <NA>
## 1 1 1 1 1 1 2245
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q32)[na.exclude(mydata$s7q32)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q32", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q32. How much did you earn from these sales in total? Magkano ang iyong kinita mula
## 0 300 500 600 1000 1200 1300 1500 1600 1700 1800 1900 2000 2200 2500 2600 2700 2800
## 5 1 1 1 2 3 1 5 1 1 3 1 7 1 4 1 1 1
## 3000 3200 3250 3400 3500 3600 4000 4500 4800 5000 5400 5500 5600 5800 6000 6500 7000 7500
## 10 1 1 1 3 1 11 6 1 7 1 2 2 1 9 1 7 2
## 8000 8076 8495 8500 9000 9500 9600 9700 10000 11000 11600 12000 12200 12600 12690 14000 14480 14500
## 9 1 1 1 3 2 1 1 6 1 1 4 1 1 1 3 1 1
## 14900 16000 16500 17000 17200 18000 19830 22000 23000 24000 26000 27000 27500 28500 30000 31500 36000 42000
## 1 2 1 1 1 3 1 1 1 1 2 2 1 1 1 1 2 1
## 50000 53436 67000 78000 <NA>
## 1 1 1 1 2122
## [1] "Frequency table after encoding"
## s7q32. How much did you earn from these sales in total? Magkano ang iyong kinita mula
## 0 300 500 600 1000 1200 1300
## 5 1 1 1 2 3 1
## 1500 1600 1700 1800 1900 2000 2200
## 5 1 1 3 1 7 1
## 2500 2600 2700 2800 3000 3200 3250
## 4 1 1 1 10 1 1
## 3400 3500 3600 4000 4500 4800 5000
## 1 3 1 11 6 1 7
## 5400 5500 5600 5800 6000 6500 7000
## 1 2 2 1 9 1 7
## 7500 8000 8076 8495 8500 9000 9500
## 2 9 1 1 1 3 2
## 9600 9700 10000 11000 11600 12000 12200
## 1 1 6 1 1 4 1
## 12600 12690 14000 14480 14500 14900 16000
## 1 1 3 1 1 1 2
## 16500 17000 17200 18000 19830 22000 23000
## 1 1 1 3 1 1 1
## 24000 26000 27000 27500 28500 30000 31500
## 1 2 2 1 1 1 1
## 36000 42000 50000 53436 67000 68484 or more <NA>
## 2 1 1 1 1 1 2122
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q35)[na.exclude(mydata$s7q35)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q35", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q35. What was the total revenue from sales of this butchered meat (sold)? Magkano an
## 0 900 1000 1300 1500 1600 1800 2000 2300 2500 2790 3000 3200 3300 4500 7200 8970 9300
## 43 1 1 1 2 1 1 2 1 2 1 1 1 1 1 1 1 1
## 9571 10800 14000 16000 21600 25600 27000 <NA>
## 1 1 1 1 1 1 1 2226
## [1] "Frequency table after encoding"
## s7q35. What was the total revenue from sales of this butchered meat (sold)? Magkano an
## 0 900 1000 1300 1500 1600 1800
## 43 1 1 1 2 1 1
## 2000 2300 2500 2790 3000 3200 3300
## 2 1 2 1 1 1 1
## 4500 7200 8970 9300 9571 10800 14000
## 1 1 1 1 1 1 1
## 16000 21600 25600 26517 or more <NA>
## 1 1 1 1 2226
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q41)[na.exclude(mydata$s7q41)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q41", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q41. How much was this start-up capital? Magkano ang panimulang puhunan?
## 0 10 15 16 20 25 30 40 45 50 58 60 70 80 90 100 110 120
## 10 1 2 1 1 1 4 2 1 6 1 2 1 1 1 17 3 2
## 130 140 150 155 156 180 190 192 200 210 228 240 250 300 320 336 350 360
## 1 1 22 2 1 1 1 1 31 1 1 3 7 29 1 1 4 3
## 400 470 500 510 530 560 600 610 700 720 750 800 840 850 900 990 1000 1050
## 4 1 23 1 1 1 9 1 3 1 4 4 1 1 1 1 11 1
## 1112 1135 1200 1300 1500 1600 1800 2000 2158 2200 2250 2400 2500 2860 3000 3500 4000 7300
## 1 1 2 2 8 1 2 3 1 1 1 1 1 1 9 2 2 1
## 8000 10000 20000 23000 27000 33750 <NA>
## 1 1 1 1 1 1 2013
## [1] "Frequency table after encoding"
## s7q41. How much was this start-up capital? Magkano ang panimulang puhunan?
## 0 10 15 16 20 25 30
## 10 1 2 1 1 1 4
## 40 45 50 58 60 70 80
## 2 1 6 1 2 1 1
## 90 100 110 120 130 140 150
## 1 17 3 2 1 1 22
## 155 156 180 190 192 200 210
## 2 1 1 1 1 31 1
## 228 240 250 300 320 336 350
## 1 3 7 29 1 1 4
## 360 400 470 500 510 530 560
## 3 4 1 23 1 1 1
## 600 610 700 720 750 800 840
## 9 1 3 1 4 4 1
## 850 900 990 1000 1050 1112 1135
## 1 1 1 11 1 1 1
## 1200 1300 1500 1600 1800 2000 2158
## 2 2 8 1 2 3 1
## 2200 2250 2400 2500 2860 3000 3500
## 1 1 1 1 1 9 2
## 4000 7300 8000 10000 20000 23000 25359 or more
## 2 1 1 1 1 1 2
## <NA>
## 2013
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q42c)[na.exclude(mydata$s7q42c)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q42c", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q42c. How much did you earn in other income? Magkano ang iyong kinita mula sa ibang p
## 0 3 100 120 140 150 160 200 250 270 300 360 400 450 500 600 700 750
## 8 1 2 1 1 4 1 11 1 1 8 1 3 2 10 6 2 2
## 800 1000 1200 1500 2000 2500 2700 3000 3500 3750 4000 5000 6000 9000 12000 15000 25500 52500
## 1 11 2 7 8 2 1 5 1 1 1 4 2 1 1 1 1 1
## 1e+05 <NA>
## 1 2179
## [1] "Frequency table after encoding"
## s7q42c. How much did you earn in other income? Magkano ang iyong kinita mula sa ibang p
## 0 3 100 120 140 150 160
## 8 1 2 1 1 4 1
## 200 250 270 300 360 400 450
## 11 1 1 8 1 3 2
## 500 600 700 750 800 1000 1200
## 10 6 2 2 1 11 2
## 1500 2000 2500 2700 3000 3500 3750
## 7 8 2 1 5 1 1
## 4000 5000 6000 9000 12000 15000 25500
## 1 4 2 1 1 1 1
## 52500 72450 or more <NA>
## 1 1 2179
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q44)[na.exclude(mydata$s7q44)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q44", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q44. What was the total revenue from these eggs (sold)? Magkano ang kabuuang kita mu
## 0 8 13 15 20 25 28 35 40 42 50 54 60 70 78 85 98 100
## 600 2 1 1 2 2 1 1 2 2 4 1 4 1 1 1 1 5
## 115 130 140 144 145 150 170 180 192 200 210 215 225 250 260 300 315 325
## 1 1 1 1 2 6 1 2 1 4 2 1 2 3 1 3 1 1
## 360 500 600 630 672 700 1000 1200 1600 4032 12600 17280 <NA>
## 3 1 4 1 1 1 1 1 1 1 1 1 1613
## [1] "Frequency table after encoding"
## s7q44. What was the total revenue from these eggs (sold)? Magkano ang kabuuang kita mu
## 0 8 13 15 20 25 28 35
## 600 2 1 1 2 2 1 1
## 40 42 50 54 60 70 78 85
## 2 2 4 1 4 1 1 1
## 98 100 115 130 140 144 145 150
## 1 5 1 1 1 1 2 6
## 170 180 192 200 210 215 225 250
## 1 2 1 4 2 1 2 3
## 260 300 315 325 360 500 600 630
## 1 3 1 1 3 1 4 1
## 672 700 1000 1200 1436 or more <NA>
## 1 1 1 1 4 1613
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q47)[na.exclude(mydata$s7q47)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q47", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q47. How much did you earn from these sales in total? Magkano ang iyong kinita mula
## 0 2 100 150 160 170 200 220 250 260 280 300 310 350 360 400 450 500
## 5 1 4 8 2 1 12 1 3 1 1 18 1 1 3 9 5 22
## 550 600 630 700 740 750 780 800 830 850 860 900 940 960 1000 1080 1200 1250
## 2 15 1 4 1 2 1 8 1 1 1 4 1 1 14 1 7 3
## 1440 1450 1500 1600 1650 1800 2000 2100 2400 2500 3000 3500 3600 3750 4000 4500 4800 5000
## 1 1 20 1 1 5 9 1 1 1 7 2 1 2 3 2 1 4
## 5300 5400 5600 6000 7000 7500 10000 12000 15000 16000 20000 25500 52500 <NA>
## 1 1 1 1 1 1 2 1 1 1 1 1 1 2053
## [1] "Frequency table after encoding"
## s7q47. How much did you earn from these sales in total? Magkano ang iyong kinita mula
## 0 2 100 150 160 170 200
## 5 1 4 8 2 1 12
## 220 250 260 280 300 310 350
## 1 3 1 1 18 1 1
## 360 400 450 500 550 600 630
## 3 9 5 22 2 15 1
## 700 740 750 780 800 830 850
## 4 1 2 1 8 1 1
## 860 900 940 960 1000 1080 1200
## 1 4 1 1 14 1 7
## 1250 1440 1450 1500 1600 1650 1800
## 3 1 1 20 1 1 5
## 2000 2100 2400 2500 3000 3500 3600
## 9 1 1 1 7 2 1
## 3750 4000 4500 4800 5000 5300 5400
## 2 3 2 1 4 1 1
## 5600 6000 7000 7500 10000 12000 15000
## 1 1 1 1 2 1 1
## 16000 20000 24344 or more <NA>
## 1 1 2 2053
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q50)[na.exclude(mydata$s7q50)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q50", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q50. What was the total revenue from sales of these butchered birds (sold)? Magkano
## 0 60 100 120 130 145 150 180 200 240 260 270 300 340 360 400 450 500
## 500 1 5 1 1 1 3 1 6 1 1 1 4 1 1 2 1 2
## 540 600 620 650 660 720 750 800 900 1000 1200 1300 1500 1600 1800 2000 2400 2500
## 1 2 1 1 1 1 2 2 1 7 2 1 1 1 1 3 1 1
## 3000 4800 11250 <NA>
## 1 1 1 1730
## [1] "Frequency table after encoding"
## s7q50. What was the total revenue from sales of these butchered birds (sold)? Magkano
## 0 60 100 120 130 145 150 180
## 500 1 5 1 1 1 3 1
## 200 240 260 270 300 340 360 400
## 6 1 1 1 4 1 1 2
## 450 500 540 600 620 650 660 720
## 1 2 1 2 1 1 1 1
## 750 800 900 1000 1200 1300 1500 1600
## 2 2 1 7 2 1 1 1
## 1800 2000 2400 2500 2587 or more <NA>
## 1 3 1 1 3 1730
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q8)[na.exclude(mydata$s7q8)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q8", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q8. What is the total market value of this number of liters of milk regardless of wh
## 1000 192000 <NA>
## 1 1 2294
## [1] "Frequency table after encoding"
## s7q8. What is the total market value of this number of liters of milk regardless of wh
## 1000 191045 or more <NA>
## 1 1 2294
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q10)[na.exclude(mydata$s7q10)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q10", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q10. In the past 12 months, how much have you spent to care for these large livestock
## 0 8 30 36 50 100 120 130 150 175 200 220 225 240 250 280 300 310
## 355 1 1 1 1 7 2 1 6 1 6 1 1 1 1 1 4 1
## 320 350 370 390 400 500 540 600 700 800 900 960 1000 1040 1500 1700 1920 2000
## 2 3 1 1 3 15 1 2 1 1 1 1 8 1 1 1 1 4
## 2160 2500 3000 6000 12000 14400 14880 15940 31200 36000 38976 <NA>
## 1 1 1 1 1 1 1 1 1 1 1 1845
## [1] "Frequency table after encoding"
## s7q10. In the past 12 months, how much have you spent to care for these large livestock
## 0 8 30 36 50 100 120
## 355 1 1 1 1 7 2
## 130 150 175 200 220 225 240
## 1 6 1 6 1 1 1
## 250 280 300 310 320 350 370
## 1 1 4 1 2 3 1
## 390 400 500 540 600 700 800
## 1 3 15 1 2 1 1
## 900 960 1000 1040 1500 1700 1920
## 1 1 8 1 1 1 1
## 2000 2160 2500 3000 6000 12000 14400
## 4 1 1 1 1 1 1
## 14880 15940 27385 or more <NA>
## 1 1 3 1845
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q14)[na.exclude(mydata$s7q14)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q14", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q14. What is the total market value of these additional animal products that you cons
## 0 200 250 370 600 2400 <NA>
## 1 1 1 1 1 1 2290
## [1] "Frequency table after encoding"
## s7q14. What is the total market value of these additional animal products that you cons
## 0 200 250 370 600 2354 or more <NA>
## 1 1 1 1 1 1 2290
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q18)[na.exclude(mydata$s7q18)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q18", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q18. What is the total market value of this butchered meat regardless of whether you
## 0 2700 9000 15000 31000 <NA>
## 1 1 1 1 1 2291
## [1] "Frequency table after encoding"
## s7q18. What is the total market value of this butchered meat regardless of whether you
## 0 2700 9000 15000 30680 or more <NA>
## 1 1 1 1 1 2291
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q26)[na.exclude(mydata$s7q26)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q26", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q26. In the past 12 months, how much have you spent to care for these small livestock
## 0 2 15 24 30 42 50 62 75 90 100 101 114 120 130
## 152 1 1 1 1 2 1 1 1 1 8 1 1 2 1
## 150 200 225 250 256 300 310 324 380 400 450 470 480 494 500
## 1 3 1 1 1 7 1 1 1 3 1 1 1 1 10
## 510 600 700 720 750 765 800 840 960 996 1000 1050 1120 1200 1344
## 1 3 3 1 1 1 1 1 1 1 13 1 1 3 1
## 1400 1440 1460 1470 1500 1600 1790 1792 1800 1848 1860 2000 2100 2200 2250
## 1 1 1 1 11 3 1 1 1 1 1 15 1 1 1
## 2400 2488 2500 2700 2760 2880 3000 3350 3360 3600 3750 3840 3900 3960 4000
## 4 1 7 1 1 1 20 1 1 4 1 1 1 1 10
## 4100 4150 4160 4400 4480 4500 4576 4640 4704 4710 4800 5000 5090 5200 5250
## 2 1 1 2 1 2 1 1 1 1 5 11 1 3 1
## 5400 5445 5500 5600 5760 6000 6240 6250 6720 6760 6800 7000 7200 7456 7500
## 2 1 1 2 1 4 1 1 1 1 1 1 2 1 4
## 7800 7920 8000 8100 8400 8800 9000 9600 9800 10000 11500 11520 12000 12120 12240
## 2 2 5 1 3 1 1 2 1 7 1 1 7 1 1
## 12480 12960 14190 14400 15000 15600 16100 16800 17600 17904 18000 18400 20000 22200 24000
## 1 1 1 3 1 1 1 3 1 1 1 1 2 1 4
## 24192 30000 33200 36000 36500 39000 40000 46560 53900 54000 57600 72000 150000 <NA>
## 1 1 1 1 1 1 1 1 1 1 1 1 1 1828
## [1] "Frequency table after encoding"
## s7q26. In the past 12 months, how much have you spent to care for these small livestock
## 0 2 15 24 30 42 50
## 152 1 1 1 1 2 1
## 62 75 90 100 101 114 120
## 1 1 1 8 1 1 2
## 130 150 200 225 250 256 300
## 1 1 3 1 1 1 7
## 310 324 380 400 450 470 480
## 1 1 1 3 1 1 1
## 494 500 510 600 700 720 750
## 1 10 1 3 3 1 1
## 765 800 840 960 996 1000 1050
## 1 1 1 1 1 13 1
## 1120 1200 1344 1400 1440 1460 1470
## 1 3 1 1 1 1 1
## 1500 1600 1790 1792 1800 1848 1860
## 11 3 1 1 1 1 1
## 2000 2100 2200 2250 2400 2488 2500
## 15 1 1 1 4 1 7
## 2700 2760 2880 3000 3350 3360 3600
## 1 1 1 20 1 1 4
## 3750 3840 3900 3960 4000 4100 4150
## 1 1 1 1 10 2 1
## 4160 4400 4480 4500 4576 4640 4704
## 1 2 1 2 1 1 1
## 4710 4800 5000 5090 5200 5250 5400
## 1 5 11 1 3 1 2
## 5445 5500 5600 5760 6000 6240 6250
## 1 1 2 1 4 1 1
## 6720 6760 6800 7000 7200 7456 7500
## 1 1 1 1 2 1 4
## 7800 7920 8000 8100 8400 8800 9000
## 2 2 5 1 3 1 1
## 9600 9800 10000 11500 11520 12000 12120
## 2 1 7 1 1 7 1
## 12240 12480 12960 14190 14400 15000 15600
## 1 1 1 1 3 1 1
## 16100 16800 17600 17904 18000 18400 20000
## 1 3 1 1 1 1 2
## 22200 24000 24192 30000 33200 36000 36500
## 1 4 1 1 1 1 1
## 39000 40000 46560 53900 54000 56394 or more <NA>
## 1 1 1 1 1 3 1828
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q30)[na.exclude(mydata$s7q30)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q30", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q30. What is the total market value of these additional animal products that you cons
## 0 240 320 800 1400 2500 2700 3000 9700 32000 <NA>
## 2 1 1 1 1 1 1 1 1 1 2285
## [1] "Frequency table after encoding"
## s7q30. What is the total market value of these additional animal products that you cons
## 0 240 320 800 1400 2500 2700
## 2 1 1 1 1 1 1
## 3000 9700 30884 or more <NA>
## 1 1 1 2285
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q34)[na.exclude(mydata$s7q34)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q34", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q34. What is the total market value of this butchered meat regardless of whether you
## 0 8 120 180 200 240 800 1000 1500 2000 2700 2790 3000 3200 3500 3600 3800 4000
## 3 1 1 1 1 1 1 2 4 1 2 1 4 1 1 2 1 4
## 4500 4900 5000 5400 6000 6200 6400 6600 7000 7150 7500 8000 9000 9300 9571 10800 12000 14000
## 4 1 3 1 1 1 1 2 4 1 1 1 2 1 1 1 1 1
## 14400 15000 16800 18000 21000 32000 48000 48600 <NA>
## 1 1 1 1 1 1 1 1 2228
## [1] "Frequency table after encoding"
## s7q34. What is the total market value of this butchered meat regardless of whether you
## 0 8 120 180 200 240 800
## 3 1 1 1 1 1 1
## 1000 1500 2000 2700 2790 3000 3200
## 2 4 1 2 1 4 1
## 3500 3600 3800 4000 4500 4900 5000
## 1 2 1 4 4 1 3
## 5400 6000 6200 6400 6600 7000 7150
## 1 1 1 1 2 4 1
## 7500 8000 9000 9300 9571 10800 12000
## 1 1 2 1 1 1 1
## 14000 14400 15000 16800 18000 21000 32000
## 1 1 1 1 1 1 1
## 48000 48399 or more <NA>
## 1 1 2228
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q43)[na.exclude(mydata$s7q43)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q43", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q43. What is the total market value of these eggs? Magkano ang kabuuang halaga sa me
## 0 3 4 5 6 7 8 10 12 13 15 18 20 24 25 28 30 35
## 45 2 1 21 29 6 2 5 4 1 3 2 3 3 2 1 3 6
## 36 40 42 45 48 49 50 54 56 60 63 64 65 66 67 68 70 72
## 4 6 2 2 5 2 14 6 2 27 1 1 5 2 1 1 15 10
## 75 78 80 81 84 85 90 91 95 96 98 100 102 105 108 110 112 120
## 2 4 5 1 4 2 5 1 3 3 2 12 1 4 1 2 1 21
## 125 126 128 130 132 140 144 150 154 156 160 161 168 172 174 175 180 182
## 6 2 1 3 1 8 3 15 1 2 8 1 4 1 4 2 20 1
## 192 198 200 210 216 224 228 240 250 252 260 273 276 280 294 300 301 306
## 1 1 5 8 4 1 1 13 13 1 1 1 1 7 1 35 1 1
## 312 315 320 324 325 330 343 345 350 356 360 364 378 390 400 420 432 450
## 1 4 2 1 1 1 1 1 6 1 15 1 1 1 4 4 1 1
## 462 480 500 504 540 550 576 600 630 640 700 720 750 756 768 800 840 864
## 1 2 14 1 2 2 1 18 3 1 2 5 2 1 1 1 3 2
## 900 960 1000 1008 1050 1152 1200 1268 1280 1344 1360 1440 1500 1544 1680 1800 1920 1932
## 2 1 8 4 2 1 5 1 1 1 1 3 1 1 1 2 1 1
## 2100 2304 2400 2500 2520 2880 3500 4000 9875 12000 12600 13824 17280 20552 21000 25000 27000 33600
## 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
## <NA>
## 1632
## [1] "Frequency table after encoding"
## s7q43. What is the total market value of these eggs? Magkano ang kabuuang halaga sa me
## 0 3 4 5 6 7 8
## 45 2 1 21 29 6 2
## 10 12 13 15 18 20 24
## 5 4 1 3 2 3 3
## 25 28 30 35 36 40 42
## 2 1 3 6 4 6 2
## 45 48 49 50 54 56 60
## 2 5 2 14 6 2 27
## 63 64 65 66 67 68 70
## 1 1 5 2 1 1 15
## 72 75 78 80 81 84 85
## 10 2 4 5 1 4 2
## 90 91 95 96 98 100 102
## 5 1 3 3 2 12 1
## 105 108 110 112 120 125 126
## 4 1 2 1 21 6 2
## 128 130 132 140 144 150 154
## 1 3 1 8 3 15 1
## 156 160 161 168 172 174 175
## 2 8 1 4 1 4 2
## 180 182 192 198 200 210 216
## 20 1 1 1 5 8 4
## 224 228 240 250 252 260 273
## 1 1 13 13 1 1 1
## 276 280 294 300 301 306 312
## 1 7 1 35 1 1 1
## 315 320 324 325 330 343 345
## 4 2 1 1 1 1 1
## 350 356 360 364 378 390 400
## 6 1 15 1 1 1 4
## 420 432 450 462 480 500 504
## 4 1 1 1 2 14 1
## 540 550 576 600 630 640 700
## 2 2 1 18 3 1 2
## 720 750 756 768 800 840 864
## 5 2 1 1 1 3 2
## 900 960 1000 1008 1050 1152 1200
## 2 1 8 4 2 1 5
## 1268 1280 1344 1360 1440 1500 1544
## 1 1 1 1 3 1 1
## 1680 1800 1920 1932 2100 2304 2400
## 1 2 1 1 1 1 1
## 2500 2520 2880 3500 4000 9875 12000
## 2 2 1 1 1 1 1
## 12600 13824 17280 20552 20858 or more <NA>
## 1 1 1 1 4 1632
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q45)[na.exclude(mydata$s7q45)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q45", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q45. In the past 12 months, how much have you spent to care for these birds (e.g. on
## 0 12 15 16 20 25 26 28 30 31 35 36 39 40 50 52 54 60
## 435 2 1 1 1 1 1 1 3 1 2 2 1 2 6 1 3 8
## 63 64 70 74 76 80 81 90 93 96 99 100 110 120 140 148 150 160
## 1 2 2 1 1 4 2 1 1 2 1 17 1 5 1 1 2 2
## 180 186 200 220 224 230 240 250 264 280 300 306 320 324 336 350 360 368
## 4 1 16 1 1 1 6 2 1 3 22 1 2 2 3 2 7 1
## 384 400 420 432 444 450 480 500 525 534 540 552 560 576 600 624 625 640
## 2 4 1 1 1 1 1 27 1 1 2 1 1 1 14 1 1 1
## 696 700 720 744 768 800 825 840 900 920 960 992 1000 1008 1056 1080 1104 1112
## 1 3 10 2 2 3 2 3 5 1 3 1 19 1 4 2 2 1
## 1116 1152 1200 1248 1296 1344 1360 1392 1440 1500 1536 1560 1600 1680 1728 1776 1800 1824
## 1 2 15 1 1 2 1 1 17 8 2 1 4 7 4 1 9 1
## 1900 1920 1950 1980 2000 2016 2019 2100 2112 2160 2248 2304 2400 2500 2520 2550 2560 2592
## 1 2 1 1 9 1 1 1 4 1 1 1 11 3 1 1 1 3
## 2664 2688 2700 2784 2800 2860 2880 3000 3024 3072 3104 3120 3168 3200 3240 3360 3456 3500
## 1 1 1 1 1 1 10 5 1 2 1 1 1 2 1 1 2 1
## 3600 3648 3650 4000 4032 4320 4400 4464 4500 4728 4800 5000 5040 5400 5600 5616 5760 5931
## 17 1 1 1 1 7 1 1 1 1 11 4 2 1 1 1 4 1
## 6000 6312 6336 6570 6912 7056 7200 7300 7500 7728 7790 8000 8160 8400 8640 9600 9756 9880
## 9 1 1 1 1 1 2 1 1 1 1 2 1 3 1 3 1 1
## 9996 10080 10800 10950 11315 11680 12000 12775 14400 15000 15120 15600 15900 18000 19440 20160 21100 22320
## 1 3 1 1 1 1 4 1 3 2 1 1 1 1 1 2 1 1
## 22560 23400 24000 26340 27000 28000 36000 46200 61920 <NA>
## 1 1 1 1 1 1 1 1 1 1293
## [1] "Frequency table after encoding"
## s7q45. In the past 12 months, how much have you spent to care for these birds (e.g. on
## 0 12 15 16 20 25 26
## 435 2 1 1 1 1 1
## 28 30 31 35 36 39 40
## 1 3 1 2 2 1 2
## 50 52 54 60 63 64 70
## 6 1 3 8 1 2 2
## 74 76 80 81 90 93 96
## 1 1 4 2 1 1 2
## 99 100 110 120 140 148 150
## 1 17 1 5 1 1 2
## 160 180 186 200 220 224 230
## 2 4 1 16 1 1 1
## 240 250 264 280 300 306 320
## 6 2 1 3 22 1 2
## 324 336 350 360 368 384 400
## 2 3 2 7 1 2 4
## 420 432 444 450 480 500 525
## 1 1 1 1 1 27 1
## 534 540 552 560 576 600 624
## 1 2 1 1 1 14 1
## 625 640 696 700 720 744 768
## 1 1 1 3 10 2 2
## 800 825 840 900 920 960 992
## 3 2 3 5 1 3 1
## 1000 1008 1056 1080 1104 1112 1116
## 19 1 4 2 2 1 1
## 1152 1200 1248 1296 1344 1360 1392
## 2 15 1 1 2 1 1
## 1440 1500 1536 1560 1600 1680 1728
## 17 8 2 1 4 7 4
## 1776 1800 1824 1900 1920 1950 1980
## 1 9 1 1 2 1 1
## 2000 2016 2019 2100 2112 2160 2248
## 9 1 1 1 4 1 1
## 2304 2400 2500 2520 2550 2560 2592
## 1 11 3 1 1 1 3
## 2664 2688 2700 2784 2800 2860 2880
## 1 1 1 1 1 1 10
## 3000 3024 3072 3104 3120 3168 3200
## 5 1 2 1 1 1 2
## 3240 3360 3456 3500 3600 3648 3650
## 1 1 2 1 17 1 1
## 4000 4032 4320 4400 4464 4500 4728
## 1 1 7 1 1 1 1
## 4800 5000 5040 5400 5600 5616 5760
## 11 4 2 1 1 1 4
## 5931 6000 6312 6336 6570 6912 7056
## 1 9 1 1 1 1 1
## 7200 7300 7500 7728 7790 8000 8160
## 2 1 1 1 1 2 1
## 8400 8640 9600 9756 9880 9996 10080
## 3 1 3 1 1 1 3
## 10800 10950 11315 11680 12000 12775 14400
## 1 1 1 1 4 1 3
## 15000 15120 15600 15900 18000 19440 20160
## 2 1 1 1 1 1 2
## 21100 22320 22560 23400 24000 26316 or more <NA>
## 1 1 1 1 1 6 1293
percentile_99.5 <- floor(quantile(na.exclude(mydata$s7q46)[na.exclude(mydata$s7q46)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="s7q46", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## s7q46. In the past 12 months, how many birds have you sold? Sa nakalipas na labindalaw
## 0 1 2 3 4 5 6 7 8 9
## 763 45 49 34 24 28 12 6 3 2
## 10 11 12 15 17 20 24 30 32 49 or more
## 18 1 1 4 1 4 2 3 1 6
## <NA>
## 1289
## [1] "Frequency table after encoding"
## s7q46. In the past 12 months, how many birds have you sold? Sa nakalipas na labindalaw
## 0 1 2 3 4 5 6 7 8 9
## 763 45 49 34 24 28 12 6 3 2
## 10 11 12 15 17 20 24 30 32 48 or more
## 18 1 1 4 1 4 2 3 1 6
## <NA>
## 1289
# !!!No Indirect PII - Categorical
# !!! Insufficient demographic data
# !!! Identify open-end variables here:
open_ends <- c("s7q1whynoresponse",
"s7q2whynoresponse",
"s7q3whynoresponse",
"s7q4whynoresponse",
"s7q5other",
"s7q5whynoresponse",
"s7q6whynoresponse",
"s7q7whynoresponse",
"s7q8whynoresponse",
"s7q9whynoresponse",
"s7q10whynoresponse",
"s7q11whynoresponse",
"s7q12whynoresponse",
"s7q13whynoresponse",
"s7q14whynoresponse",
"s7q15whynoresponse",
"s7q16whynoresponse",
"s7q17whynoresponse",
"s7q18whynoresponse",
"s7q19whynoresponse",
"s7q20whynoresponse",
"s7q21whynoresponse",
"s7q22whynoresponse",
"s7q23whynoresponse",
"s7q24other",
"s7q24whynoresponse",
"s7q25whynoresponse",
"s7q26whynoresponse",
"s7q27whynoresponse",
"s7q28whynoresponse",
"s7q29whynoresponse",
"s7q30whynoresponse",
"s7q31whynoresponse",
"s7q32whynoresponse",
"s7q33whynoresponse",
"s7q34whynoresponse",
"s7q35whynoresponse",
"s7q36whynoresponse",
"s7q37whynoresponse",
"s7q38whynoresponse",
"s7q39whynoresponse",
"s7q40other",
"s7q40whynoresponse",
"s7q41whynoresponse",
"s7q42bwhynoresponse",
"s7q42cwhynoresponse",
"s7q42whynoresponse",
"s7q43whynoresponse",
"s7q44whynoresponse",
"s7q45whynoresponse",
"s7q46whynoresponse",
"s7q47whynoresponse",
"s7q48whynoresponse",
"s7q48awhynoresponse",
"s7q49whynoresponse",
"s7q50whynoresponse")
report_open (list_open_ends = open_ends)
# Review "verbatims.csv". Identify variables to be deleted or redacted and their row number
mydata$s7q40other[798] <- "Everyday income from [Wholesale and retail trade]"
mydata$s7q40other[1501] <- "[language]"
mydata$s7q42cwhynoresponse[1570] <- "Just the son who in Manila right is the one who knows the price of what he earned for the [activity]."
# !!!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)