rm(list=ls(all=t))

Setup filenames

filename <- "Section_9" # !!!Update filename
functions_vers <-  "functions_1.8.R" # !!!Update helper functions file

Setup data, functions and create dictionary for dataset review

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 

Direct PII: variables to be removed

# !!!No Direct PII

Direct PII-team: Encode field team names

# !!!No Direct PII-team

Small locations: Encode locations with pop <100,000 using random large numbers

# !!!No Small Locations

Indirect PII - Ordinal: Global recode or Top/bottom coding for extreme values

# Focus on variables with a "Lowest Freq" in dictionary of 30 or less. 

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q2)[na.exclude(mydata$eh_s9q2)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q2", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q2. How many units of agricultural land, including garden plots does your household 
##  -998     1     2     3     4     5     6     7     8     9    10    12    13    15    16    17    18    20    25    30    32    34    35    36    40    45    50    60 
##    11    89    29    18     5    33     8     5     3     2    17     1     1     9     4     1     2    13     5     8     1     1     1     3     3     1    11     1 
##    70    75    80    90   100   110   125   135   150   162   200   230   250   283   300   400   450   500   576   600   700   800   900   992  1000  1200  1250  2000 
##     2     1     3     2    11     1     1     1     4     1     5     1     6     1     5     4     1    11     1     1     1     2     2     1     3     1     1     4 
##  2072  2233  2500  2900  3024  3300  4000  4730  5000  5681  6000  7500  8000 10000 10500 12500 15000 16000 18000 22000 25000  <NA> 
##     1     1    17     1     1     2     1     1    23     1     2     1     1     4     1     1     2     1     1     1     1  1859

## [1] "Frequency table after encoding"
## eh_s9q2. How many units of agricultural land, including garden plots does your household 
##          -998             1             2             3             4             5             6             7             8             9            10            12 
##            11            89            29            18             5            33             8             5             3             2            17             1 
##            13            15            16            17            18            20            25            30            32            34            35            36 
##             1             9             4             1             2            13             5             8             1             1             1             3 
##            40            45            50            60            70            75            80            90           100           110           125           135 
##             3             1            11             1             2             1             3             2            11             1             1             1 
##           150           162           200           230           250           283           300           400           450           500           576           600 
##             4             1             5             1             6             1             5             4             1            11             1             1 
##           700           800           900           992          1000          1200          1250          2000          2072          2233          2500          2900 
##             1             2             2             1             3             1             1             4             1             1            17             1 
##          3024          3300          4000          4730          5000          5681          6000          7500          8000         10000         10500         12500 
##             1             2             1             1            23             1             2             1             1             4             1             1 
##         15000         16000 17720 or more          <NA> 
##             2             1             3          1859

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q7)[na.exclude(mydata$eh_s9q7)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q7", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q7. Q347: House  Bahay
##    0    1    2    3    4 5000 
##  189 2028   66    3    1    1

## [1] "Frequency table after encoding"
## eh_s9q7. Q347: House  Bahay
##         0         1 2 or more 
##       189      2028        71

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q8)[na.exclude(mydata$eh_s9q8)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q8", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q8. Large or small livestock such as pigs, goats, carabao, cows, etc.  Malaki o mali
##    0    1    2    3    4    5    6    7    8    9   10   11   12   14   16   22   29   30 
## 1699  236  154   84   31   31   11   10    8    7    3    2    2    2    2    2    1    3

## [1] "Frequency table after encoding"
## eh_s9q8. Large or small livestock such as pigs, goats, carabao, cows, etc.  Malaki o mali
##          0          1          2          3          4          5          6          7          8          9         10 11 or more 
##       1699        236        154         84         31         31         11         10          8          7          3         14

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q9)[na.exclude(mydata$eh_s9q9)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q9", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q9. Birds, poultry, roosters, fighting cocks, ducks.  Mga Ibon, manok, tandang, itik
##    0    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   32   33 
## 1005   90  121   91   94   72   66   58   57   40  109   31   30   29   19   62   16    9   20   11   67   12    6   10    6   17    9    3    6    2   28    8    1 
##   34   35   36   37   38   39   40   42   43   45   48   50   55   57   60   63   65   68   73   80   95  100  120  140  200 
##    4    6    7    3    1    1   12    5    4    3    1   14    4    1    4    1    1    1    2    1    1    3    1    1    1

## [1] "Frequency table after encoding"
## eh_s9q9. Birds, poultry, roosters, fighting cocks, ducks.  Mga Ibon, manok, tandang, itik
##          0          1          2          3          4          5          6          7          8          9         10         11         12         13         14 
##       1005         90        121         91         94         72         66         58         57         40        109         31         30         29         19 
##         15         16         17         18         19         20         21         22         23         24         25         26         27         28         29 
##         62         16          9         20         11         67         12          6         10          6         17          9          3          6          2 
##         30         32         33         34         35         36         37         38         39         40         42         43         45         48         50 
##         28          8          1          4          6          7          3          1          1         12          5          4          3          1         14 
##         55         57         60         63 64 or more 
##          4          1          4          1         12

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q10)[na.exclude(mydata$eh_s9q10)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q10", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q10. Boats  Bangka
##    0    1    2    3 
## 2198   83    6    1

## [1] "Frequency table after encoding"
## eh_s9q10. Boats  Bangka
##         0 1 or more 
##      2198        90

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q12)[na.exclude(mydata$eh_s9q12)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q12", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q12. Q349: Cell Phone  Cellphone
##   0   1   2   3   4   5   6   7   8   9  16 
## 121 591 717 468 242  89  32  14   8   5   1

## [1] "Frequency table after encoding"
## eh_s9q12. Q349: Cell Phone  Cellphone
##         0         1         2         3         4         5         6         7 8 or more 
##       121       591       717       468       242        89        32        14        14

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q13)[na.exclude(mydata$eh_s9q13)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q13", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q13. Q350: Sofa  Sofa
##    0    1    2    3    4    5    6 
## 1648  493   81   51    9    4    2

## [1] "Frequency table after encoding"
## eh_s9q13. Q350: Sofa  Sofa
##         0         1         2         3 4 or more 
##      1648       493        81        51        15

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q14)[na.exclude(mydata$eh_s9q14)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q14", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q14. Q351: Chairs  Mga silya
##   0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  20  26 
## 470 271 351 326 320 157 194  66  65  20  19   6  12   3   4   2   1   1

## [1] "Frequency table after encoding"
## eh_s9q14. Q351: Chairs  Mga silya
##          0          1          2          3          4          5          6          7          8          9         10         11 12 or more 
##        470        271        351        326        320        157        194         66         65         20         19          6         23

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q15)[na.exclude(mydata$eh_s9q15)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q15", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q15. Q352: Table  Lamesa
##    0    1    2    3    4    5    6 
##  201 1383  508  147   37   10    2

## [1] "Frequency table after encoding"
## eh_s9q15. Q352: Table  Lamesa
##         0         1         2         3 4 or more 
##       201      1383       508       147        49

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q16)[na.exclude(mydata$eh_s9q16)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q16", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q16. Q353: Clock/Watch  Relo
##   0   1   2   3   4   5   6   7   8   9  10  12 
## 865 886 308 123  61  26   9   5   2   1   1   1

## [1] "Frequency table after encoding"
## eh_s9q16. Q353: Clock/Watch  Relo
##         0         1         2         3         4         5 6 or more 
##       865       886       308       123        61        26        19

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q17)[na.exclude(mydata$eh_s9q17)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q17", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q17. Other jewelry.  Mga alahas
## -998    0    1    2    3    4    5    6    7    8    9   10   11   12   13   14   20   26   30 
##    1 1477  211  183  160   86   54   46   20   10   16   11    3    2    3    2    1    1    1

## [1] "Frequency table after encoding"
## eh_s9q17. Other jewelry.  Mga alahas
##       -998          0          1          2          3          4          5          6          7          8          9         10 11 or more 
##          1       1477        211        183        160         86         54         46         20         10         16         11         13

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q18)[na.exclude(mydata$eh_s9q18)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q18", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q18. Q354: Bicycle  Bisekleta
##    0    1    2    3    4    5    6    7 
## 1695  493   77   17    3    1    1    1

## [1] "Frequency table after encoding"
## eh_s9q18. Q354: Bicycle  Bisekleta
##         0         1         2 3 or more 
##      1695       493        77        23

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q19)[na.exclude(mydata$eh_s9q19)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q19", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q19. Q355: Tricycle  Tricycle
##    0    1    2    3    5 
## 2034  244    6    2    2

## [1] "Frequency table after encoding"
## eh_s9q19. Q355: Tricycle  Tricycle
##         0 1 or more 
##      2034       254

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q20)[na.exclude(mydata$eh_s9q20)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q20", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q20. Q356: Motorbike  Motor
##    0    1    2    3    4    7 
## 1636  584   58    6    3    1

## [1] "Frequency table after encoding"
## eh_s9q20. Q356: Motorbike  Motor
##         0         1 2 or more 
##      1636       584        68

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q21)[na.exclude(mydata$eh_s9q21)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q21", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q21. Q357: Motorized Boat/Banca  Bangkang de-makina/ bangka
##    0    1    2 
## 2164  115    9

## [1] "Frequency table after encoding"
## eh_s9q21. Q357: Motorized Boat/Banca  Bangkang de-makina/ bangka
##         0 1 or more 
##      2164       124

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q22)[na.exclude(mydata$eh_s9q22)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q22", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q22. Q358: Other Motorized Vehicle  Iba pang sasakyang de-motor
##    0    1 
## 2269   19

## [1] "Frequency table after encoding"
## eh_s9q22. Q358: Other Motorized Vehicle  Iba pang sasakyang de-motor
##         0 1 or more 
##      2269        19

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q23)[na.exclude(mydata$eh_s9q23)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q23", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q23. Q359: Radio, Tape, or CD Player  Radyo, Tape o CD Player
##    0    1    2    3    5 
## 1297  944   42    3    2

## [1] "Frequency table after encoding"
## eh_s9q23. Q359: Radio, Tape, or CD Player  Radyo, Tape o CD Player
##         0         1 2 or more 
##      1297       944        47

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q24)[na.exclude(mydata$eh_s9q24)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q24", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q24. Q360: Beds  Mga kama
##    0    1    2    3    4    5    6 
## 1115  656  373  125   16    1    2

## [1] "Frequency table after encoding"
## eh_s9q24. Q360: Beds  Mga kama
##         0         1         2         3 4 or more 
##      1115       656       373       125        19

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q25)[na.exclude(mydata$eh_s9q25)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q25", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q25. Q361: Mattresses  Mga kutson ng kama
##    0    1    2    3    4    5    6 
## 1057  731  370  100   26    3    1

## [1] "Frequency table after encoding"
## eh_s9q25. Q361: Mattresses  Mga kutson ng kama
##         0         1         2         3 4 or more 
##      1057       731       370       100        30

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q26)[na.exclude(mydata$eh_s9q26)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q26", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q26. Q362: Solar Panel  Solar Panel
##    0    1    3 
## 2243   44    1

## [1] "Frequency table after encoding"
## eh_s9q26. Q362: Solar Panel  Solar Panel
##         0 1 or more 
##      2243        45

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q28)[na.exclude(mydata$eh_s9q28)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q28", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q28. Q364: Television  TV
##    0    1    2    3    4   20 
##  494 1683  104    5    1    1

## [1] "Frequency table after encoding"
## eh_s9q28. Q364: Television  TV
##         0         1 2 or more 
##       494      1683       111

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q29)[na.exclude(mydata$eh_s9q29)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q29", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q29. Q365: VCR/DVD  VCR/DVD
##    0    1    2    3 
## 1613  648   26    1

## [1] "Frequency table after encoding"
## eh_s9q29. Q365: VCR/DVD  VCR/DVD
##         0         1 2 or more 
##      1613       648        27

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q30)[na.exclude(mydata$eh_s9q30)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q30", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q30. Q366: Computer  Computer
##    0    1    2    3    4    7 
## 2208   71    6    1    1    1

## [1] "Frequency table after encoding"
## eh_s9q30. Q366: Computer  Computer
##         0 1 or more 
##      2208        80

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q31)[na.exclude(mydata$eh_s9q31)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q31", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q31. Q368: Wheelbarrow  Kareta
##    0    1 
## 2266   22

## [1] "Frequency table after encoding"
## eh_s9q31. Q368: Wheelbarrow  Kareta
##         0 1 or more 
##      2266        22

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q32)[na.exclude(mydata$eh_s9q32)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q32", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q32. Q369: Cart  Kariton
##    0    1    2 
## 2193   92    3

## [1] "Frequency table after encoding"
## eh_s9q32. Q369: Cart  Kariton
##         0 1 or more 
##      2193        95

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q33)[na.exclude(mydata$eh_s9q33)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q33", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q33. Q370: Kerosene or propane stove  Kerosene o propane stove
##    0    1    2    3    6   11 
## 1592  680   12    2    1    1

## [1] "Frequency table after encoding"
## eh_s9q33. Q370: Kerosene or propane stove  Kerosene o propane stove
##         0         1 2 or more 
##      1592       680        16

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q34)[na.exclude(mydata$eh_s9q34)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q34", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q34. Q371: Stove with Oven/Gas Range  Stove na may oven/gas range
##    0    1    2    3 
## 1896  382    7    3

## [1] "Frequency table after encoding"
## eh_s9q34. Q371: Stove with Oven/Gas Range  Stove na may oven/gas range
##         0 1 or more 
##      1896       392

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q35)[na.exclude(mydata$eh_s9q35)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q35", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q35. Q372: Refrigerator  Refrigerator
##    0    1    2 
## 1861  415   12

## [1] "Frequency table after encoding"
## eh_s9q35. Q372: Refrigerator  Refrigerator
##         0 1 or more 
##      1861       427

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q36)[na.exclude(mydata$eh_s9q36)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q36", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q36. Q373: Clothes Washing Machine  Washing Machine
##    0    1    2    3 
## 1594  680   13    1

## [1] "Frequency table after encoding"
## eh_s9q36. Q373: Clothes Washing Machine  Washing Machine
##         0         1 2 or more 
##      1594       680        14

mydata <- top_recode (variable="eh_s9q37", break_point=1, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q37. Q374: Air Conditioner  Air Con
##    0    1    2 
## 2276   11    1

## [1] "Frequency table after encoding"
## eh_s9q37. Q374: Air Conditioner  Air Con
##         0 1 or more 
##      2276        12

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q38)[na.exclude(mydata$eh_s9q38)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q38", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q38. Q375: Electric Fan  Electric Fan
##    0    1    2    3    4    5    6 
##  539 1030  538  135   38    6    2

## [1] "Frequency table after encoding"
## eh_s9q38. Q375: Electric Fan  Electric Fan
##         0         1         2         3 4 or more 
##       539      1030       538       135        46

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q39)[na.exclude(mydata$eh_s9q39)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q39", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q39. Q377: Pedicab  Pedicab
##    0    1    2 
## 2191   91    6

## [1] "Frequency table after encoding"
## eh_s9q39. Q377: Pedicab  Pedicab
##         0 1 or more 
##      2191        97

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q40)[na.exclude(mydata$eh_s9q40)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q40", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q40. Q378: Rice Stocks [Un-milled dry rice]  Palay
##    0    1    2    3    4    5    6    7    8    9   10   12   13   14   15   17   18   20   22   23   28   30   32   34   50   90  280 
## 2023   51   34   29   15   28   13    9   12   11   22    5    4    4   10    1    3    3    1    2    1    2    1    1    1    1    1

## [1] "Frequency table after encoding"
## eh_s9q40. Q378: Rice Stocks [Un-milled dry rice]  Palay
##          0          1          2          3          4          5          6          7          8          9         10         12         13         14         15 
##       2023         51         34         29         15         28         13          9         12         11         22          5          4          4         10 
##         17         18 20 or more 
##          1          3         14

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q41)[na.exclude(mydata$eh_s9q41)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q41", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q41. Q381: House  Bahay
##    -999    -998       0       1       5      10      20      25      40      50      60      80     150     200     300     500     700     800    1000    1800    2000 
##       1      22       2       2       1       1       2       1       1       3       1       1       1       2       1       5       1       1      16       1      22 
##    2500    3000    4000    5000    6000    6500    7000    8000    9000   10000   11000   11008   12000   13008   13500   14000   15000   17000   20000   22000   25000 
##       2      22       9      89      14       1      20      10       3     195       4       1       8       1       1       1      93       1     183       1      46 
##   26000   27000   28000   30000   31500   35000   38000   40000   42000   45000   50000   53500   55000   56500   60000   63000   64500   65000   66000   70000   75000 
##       2       2       1     193       1      23       1      65       1       6     299       1       3       1      52       1       1       3       1      55       7 
##   80000   82000   85000   90000   95000   1e+05  102000  105000  110000  120000  130000  140000  150000  160000  170000  180000   2e+05  205000  207000  210000  225000 
##      48       1       2      13       1     201       1       1       2       9       9       1      77       1       2       2      70       1       1       1       1 
##  250000  255000  270000  290000   3e+05  320000  350000  385000   4e+05  450000   5e+05  550000   6e+05   8e+05   1e+06 1300000 1500000 1650000   2e+06 2500000   5e+06 
##      14       1       1       1      50       1       7       1      12       1      25       2       3       4      10       1       1       1       3       1       1 
## 4.5e+07    <NA> 
##       1     189

## [1] "Frequency table after encoding"
## eh_s9q41. Q381: House  Bahay
##          -999          -998             0             1             5            10            20            25            40            50            60            80 
##             1            22             2             2             1             1             2             1             1             3             1             1 
##           150           200           300           500           700           800          1000          1800          2000          2500          3000          4000 
##             1             2             1             5             1             1            16             1            22             2            22             9 
##          5000          6000          6500          7000          8000          9000         10000         11000         11008         12000         13008         13500 
##            89            14             1            20            10             3           195             4             1             8             1             1 
##         14000         15000         17000         20000         22000         25000         26000         27000         28000         30000         31500         35000 
##             1            93             1           183             1            46             2             2             1           193             1            23 
##         38000         40000         42000         45000         50000         53500         55000         56500         60000         63000         64500         65000 
##             1            65             1             6           299             1             3             1            52             1             1             3 
##         66000         70000         75000         80000         82000         85000         90000         95000         1e+05        102000        105000        110000 
##             1            55             7            48             1             2            13             1           201             1             1             2 
##        120000        130000        140000        150000        160000        170000        180000         2e+05        205000        207000        210000        225000 
##             9             9             1            77             1             2             2            70             1             1             1             1 
##        250000        255000        270000        290000         3e+05        320000        350000        385000         4e+05        450000         5e+05        550000 
##            14             1             1             1            50             1             7             1            12             1            25             2 
##         6e+05         8e+05 1e+06 or more          <NA> 
##             3             4            19           189

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q42)[na.exclude(mydata$eh_s9q42)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q42", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q42. Other landholdings including agricultural land or garden plots.
##     -999     -998        0        1      100      126      300      500      900     1000     1500     2000     3000     4000     5000     6000     7000     7500 
##        1       14        5        1        1        1        1        8        1       10        3       11        7        2       42        2        2        1 
##     8000    10000    11400    15000    17500    18000    19500    20000    25000    30000    35000    36000    40000    45000    46000    47500    48000    50000 
##        2       20        1       13        1        1        1       26        9       19        1        1        8        2        1        1        1       39 
##    52000    60000    70000    75000    80000    87500    90000    1e+05   110000   115000   120000   130000   150000   180000    2e+05   250000   267600    3e+05 
##        1        7        3        3        2        1        1       38        1        1        3        1       15        4       17        5        1       13 
##   350000   380000    4e+05    5e+05    6e+05    7e+05    8e+05    1e+06  1300000  1500000  1800000    2e+06    3e+06  3300000  3700000 10050000  1.5e+07  1.6e+07 
##        3        1        5       16        1        1        1        4        1        3        1        1        4        1        1        1        1        1 
##    2e+07    3e+07    1e+08 3.75e+08     <NA> 
##        1        2        1        1     1859

## [1] "Frequency table after encoding"
## eh_s9q42. Other landholdings including agricultural land or garden plots.
##          -999          -998             0             1           100           126           300           500           900          1000          1500          2000 
##             1            14             5             1             1             1             1             8             1            10             3            11 
##          3000          4000          5000          6000          7000          7500          8000         10000         11400         15000         17500         18000 
##             7             2            42             2             2             1             2            20             1            13             1             1 
##         19500         20000         25000         30000         35000         36000         40000         45000         46000         47500         48000         50000 
##             1            26             9            19             1             1             8             2             1             1             1            39 
##         52000         60000         70000         75000         80000         87500         90000         1e+05        110000        115000        120000        130000 
##             1             7             3             3             2             1             1            38             1             1             3             1 
##        150000        180000         2e+05        250000        267600         3e+05        350000        380000         4e+05         5e+05         6e+05         7e+05 
##            15             4            17             5             1            13             3             1             5            16             1             1 
##         8e+05         1e+06       1300000       1500000       1800000         2e+06         3e+06       3300000       3700000      10050000       1.5e+07       1.6e+07 
##             1             4             1             3             1             1             4             1             1             1             1             1 
##         2e+07 3e+07 or more          <NA> 
##             1             4          1859

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q43)[na.exclude(mydata$eh_s9q43)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q43", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q43. Agricultural farm tools and equipment.
##      0     10     20     50     60     70    100    120    140    150    180    200    250    270    280    300    320    335    340    350    400    450    470    500 
##     12      1      1      7      1      1     13      1      1     14      3     19     17      1      1     25      1      1      1      5      7      2      2     33 
##    550    600    650    680    700    750    800    900   1000   1150   1200   1250   1300   1350   1500   1800   2000   2100   2200   2250   2300   2350   2400   2500 
##      1      8      1      1      9      3      7      3     42      2      3      1      3      1     26      4     29      1      1      1      2      1      1     16 
##   2550   2600   3000   3100   3300   3500   3600   3700   4000   4200   4500   5000   5100   5400   6000   6100   6180   6500   7000   8000   9000  10000  10500  10560 
##      1      1     20      1      1      6      2      1      7      1      5     25      1      1      6      1      1      1      8      6      1     17      1      1 
##  10700  11000  12000  14000  14100  15000  15500  16000  18150  20000  22000  24000  25000  26000  27000  28000  30000  35000  38000  41000  45000  50000  52350  55000 
##      1      1      2      1      1      7      2      1      1      7      1      1      1      2      1      2      7      2      1      1      1      4      1      1 
##  57000  62500  75000  80000  1e+05 150000  3e+05   <NA> 
##      1      1      1      2      4      1      1   1774

## [1] "Frequency table after encoding"
## eh_s9q43. Agricultural farm tools and equipment.
##             0            10            20            50            60            70           100           120           140           150           180           200 
##            12             1             1             7             1             1            13             1             1            14             3            19 
##           250           270           280           300           320           335           340           350           400           450           470           500 
##            17             1             1            25             1             1             1             5             7             2             2            33 
##           550           600           650           680           700           750           800           900          1000          1150          1200          1250 
##             1             8             1             1             9             3             7             3            42             2             3             1 
##          1300          1350          1500          1800          2000          2100          2200          2250          2300          2350          2400          2500 
##             3             1            26             4            29             1             1             1             2             1             1            16 
##          2550          2600          3000          3100          3300          3500          3600          3700          4000          4200          4500          5000 
##             1             1            20             1             1             6             2             1             7             1             5            25 
##          5100          5400          6000          6100          6180          6500          7000          8000          9000         10000         10500         10560 
##             1             1             6             1             1             1             8             6             1            17             1             1 
##         10700         11000         12000         14000         14100         15000         15500         16000         18150         20000         22000         24000 
##             1             1             2             1             1             7             2             1             1             7             1             1 
##         25000         26000         27000         28000         30000         35000         38000         41000         45000         50000         52350         55000 
##             1             2             1             2             7             2             1             1             1             4             1             1 
##         57000         62500         75000         80000 1e+05 or more          <NA> 
##             1             1             1             2             6          1774

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q44)[na.exclude(mydata$eh_s9q44)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q44", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q44. Large or small livestock.  Malaki o maliit na hayupan
##   -998      0    100    300    350    600   1000   1200   1500   2000   2200   2300   2500   2800   3000   3500   4000   4200   4500   4600   4800   5000   5700   6000 
##      2      1      1      2      1      2      5      3      8     14      1      1      5      1     19      5     14      1      6      1      1     21      1     20 
##   6400   6600   6800   7000   7150   7500   8000   9000   9450   9600   9900  10000  10500  11000  11200  11500  11700  12000  12500  13000  14000  15000  15500  16000 
##      1      1      1     18      1      2     15     11      1      1      1     29      1      2      1      2      1     13      1      6      5     31      2      6 
##  17000  17500  18000  19000  20000  21000  21500  22000  23000  23500  24000  24500  25000  25200  26000  26400  27000  27500  28700  29000  30000  31000  32000  32400 
##      1      2     11      2     41      1      1      2      3      1      3      1     29      1      2      1      2      1      1      1     31      1      4      1 
##  32500  33000  34000  35000  36000  37000  38000  39500  40000  40500  41000  42000  42500  43000  43500  45000  46000  47000  48000  49000  50000  50500  53000  54000 
##      1      5      3     11      3      1      7      1     11      1      2      1      1      2      1      8      2      3      3      1     10      1      1      1 
##  55000  56000  57000  57500  58000  58500  59000  60000  62000  63000  64000  67000  70000  72500  74000  75000  77000  80000  81000  83000  85000  87000  90000  1e+05 
##      4      3      1      1      1      1      1     14      1      1      1      2      2      1      1      3      1      2      1      1      1      1      6      4 
## 104000 107500 111000 114000 114800 116000 120000 126000 130000 150000 157000 162000 180000  2e+05 220000 256000   <NA> 
##      1      1      1      1      1      2      1      1      1      2      1      1      1      3      1      1   1699

## [1] "Frequency table after encoding"
## eh_s9q44. Large or small livestock.  Malaki o maliit na hayupan
##          -998             0           100           300           350           600          1000          1200          1500          2000          2200          2300 
##             2             1             1             2             1             2             5             3             8            14             1             1 
##          2500          2800          3000          3500          4000          4200          4500          4600          4800          5000          5700          6000 
##             5             1            19             5            14             1             6             1             1            21             1            20 
##          6400          6600          6800          7000          7150          7500          8000          9000          9450          9600          9900         10000 
##             1             1             1            18             1             2            15            11             1             1             1            29 
##         10500         11000         11200         11500         11700         12000         12500         13000         14000         15000         15500         16000 
##             1             2             1             2             1            13             1             6             5            31             2             6 
##         17000         17500         18000         19000         20000         21000         21500         22000         23000         23500         24000         24500 
##             1             2            11             2            41             1             1             2             3             1             3             1 
##         25000         25200         26000         26400         27000         27500         28700         29000         30000         31000         32000         32400 
##            29             1             2             1             2             1             1             1            31             1             4             1 
##         32500         33000         34000         35000         36000         37000         38000         39500         40000         40500         41000         42000 
##             1             5             3            11             3             1             7             1            11             1             2             1 
##         42500         43000         43500         45000         46000         47000         48000         49000         50000         50500         53000         54000 
##             1             2             1             8             2             3             3             1            10             1             1             1 
##         55000         56000         57000         57500         58000         58500         59000         60000         62000         63000         64000         67000 
##             4             3             1             1             1             1             1            14             1             1             1             2 
##         70000         72500         74000         75000         77000         80000         81000         83000         85000         87000         90000         1e+05 
##             2             1             1             3             1             2             1             1             1             1             6             4 
##        104000        107500        111000        114000        114800        116000        120000        126000        130000        150000        157000        162000 
##             1             1             1             1             1             2             1             1             1             2             1             1 
##        180000 2e+05 or more          <NA> 
##             1             5          1699

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q45)[na.exclude(mydata$eh_s9q45)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q45", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q45. Birds, poultry, roosters, ducks.  Mga Ibon, manok, tandang, itik
##  -998     0    10    20    25    32    50    60    65    70    75    80    90   100   120   125   150   180   190   200   210   240   250   260   280   286   300   320 
##     6    10     1     2     1     1     7     1     1     1     1     2     2    26     1     1    28     2     1    47     1     3    10     1     2     1    57     1 
##   350   360   390   400   405   410   420   430   440   450   480   490   500   510   515   540   550   600   620   630   650   675   700   720   725   750   755   770 
##     4     2     3    27     1     1     3     1     1    27     2     2    96     1     1     1     3    56     1     1     1     1    26     5     1     9     1     1 
##   780   800   820   840   850   860   870   875   890   900   950   960   975  1000  1040  1050  1080  1100  1110  1180  1200  1225  1250  1280  1300  1320  1330  1350 
##     1    31     1     1     4     1     2     1     1    16     1     1     1    80     1     5     3     5     1     1    17     1     2     1     9     1     1     4 
##  1360  1375  1400  1440  1450  1475  1500  1530  1550  1560  1570  1600  1650  1680  1700  1720  1740  1750  1760  1800  1825  1850  1875  1900  1920  1925  1930  1950 
##     1     2    12     3     1     1    65     1     1     1     1     6     1     2     4     1     1     5     1    13     1     1     1     2     1     1     1     2 
##  2000  2020  2050  2100  2150  2180  2200  2225  2250  2300  2320  2370  2400  2450  2500  2525  2550  2580  2600  2625  2800  2880  2900  2920  3000  3050  3100  3115 
##    80     1     1     5     1     1     2     1     8     4     1     1     6     1    27     1     1     1     1     1     2     1     2     1    69     1     1     1 
##  3125  3150  3200  3250  3300  3375  3400  3500  3550  3600  3700  3740  3750  3800  3840  4000  4090  4125  4150  4200  4300  4350  4400  4440  4450  4500  4600  4700 
##     1     4     3     1     4     1     2     6     1     2     2     1     3     1     1    16     1     1     2     1     1     2     1     1     1     8     2     3 
##  4800  5000  5080  5200  5250  5300  5400  5420  5500  5730  6000  6250  6500  6550  6750  6800  7000  7500  7600  8000  8100  8600  9000  9500 10000 10500 11000 11650 
##     2    32     1     1     1     1     1     1     7     1    16     1     2     1     1     1     5     3     1     5     1     1     3     1    24     1     2     1 
## 12000 13000 14000 15000 15500 16000 16050 16900 18000 19000 20000 21000 25000 29500 30000 35000 37500 40000 50000 57500 60000 75000 85000 1e+05  <NA> 
##     5     2     3     7     1     1     1     1     1     1     3     1     1     1     2     2     1     4     2     1     1     1     1     1  1005

## [1] "Frequency table after encoding"
## eh_s9q45. Birds, poultry, roosters, ducks.  Mga Ibon, manok, tandang, itik
##          -998             0            10            20            25            32            50            60            65            70            75            80 
##             6            10             1             2             1             1             7             1             1             1             1             2 
##            90           100           120           125           150           180           190           200           210           240           250           260 
##             2            26             1             1            28             2             1            47             1             3            10             1 
##           280           286           300           320           350           360           390           400           405           410           420           430 
##             2             1            57             1             4             2             3            27             1             1             3             1 
##           440           450           480           490           500           510           515           540           550           600           620           630 
##             1            27             2             2            96             1             1             1             3            56             1             1 
##           650           675           700           720           725           750           755           770           780           800           820           840 
##             1             1            26             5             1             9             1             1             1            31             1             1 
##           850           860           870           875           890           900           950           960           975          1000          1040          1050 
##             4             1             2             1             1            16             1             1             1            80             1             5 
##          1080          1100          1110          1180          1200          1225          1250          1280          1300          1320          1330          1350 
##             3             5             1             1            17             1             2             1             9             1             1             4 
##          1360          1375          1400          1440          1450          1475          1500          1530          1550          1560          1570          1600 
##             1             2            12             3             1             1            65             1             1             1             1             6 
##          1650          1680          1700          1720          1740          1750          1760          1800          1825          1850          1875          1900 
##             1             2             4             1             1             5             1            13             1             1             1             2 
##          1920          1925          1930          1950          2000          2020          2050          2100          2150          2180          2200          2225 
##             1             1             1             2            80             1             1             5             1             1             2             1 
##          2250          2300          2320          2370          2400          2450          2500          2525          2550          2580          2600          2625 
##             8             4             1             1             6             1            27             1             1             1             1             1 
##          2800          2880          2900          2920          3000          3050          3100          3115          3125          3150          3200          3250 
##             2             1             2             1            69             1             1             1             1             4             3             1 
##          3300          3375          3400          3500          3550          3600          3700          3740          3750          3800          3840          4000 
##             4             1             2             6             1             2             2             1             3             1             1            16 
##          4090          4125          4150          4200          4300          4350          4400          4440          4450          4500          4600          4700 
##             1             1             2             1             1             2             1             1             1             8             2             3 
##          4800          5000          5080          5200          5250          5300          5400          5420          5500          5730          6000          6250 
##             2            32             1             1             1             1             1             1             7             1            16             1 
##          6500          6550          6750          6800          7000          7500          7600          8000          8100          8600          9000          9500 
##             2             1             1             1             5             3             1             5             1             1             3             1 
##         10000         10500         11000         11650         12000         13000         14000         15000         15500         16000         16050         16900 
##            24             1             2             1             5             2             3             7             1             1             1             1 
##         18000         19000         20000         21000         25000         29500         30000         35000         37500         40000 45899 or more          <NA> 
##             1             1             3             1             1             1             2             2             1             4             7          1005

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q46)[na.exclude(mydata$eh_s9q46)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q46", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q46. Boats  Bangka
##   450   500   700   800  1000  1500  2000  2500  3000  3500  4000  4500  5000  6000  7000  7500  8000 10000 12000 14000 15000 18000 20000 25000 30000 40000 43000 50000 
##     1     2     1     1     5     1     5     1     8     1     4     1    12     4     8     1     4     8     1     1     6     1     4     2     1     1     1     3 
## 51000  <NA> 
##     1  2198

## [1] "Frequency table after encoding"
## eh_s9q46. Boats  Bangka
##           450           500           700           800          1000          1500          2000          2500          3000          3500          4000          4500 
##             1             2             1             1             5             1             5             1             8             1             4             1 
##          5000          6000          7000          7500          8000         10000         12000         14000         15000         18000         20000         25000 
##            12             4             8             1             4             8             1             1             6             1             4             2 
##         30000         40000         43000         50000 50554 or more          <NA> 
##             1             1             1             3             1          2198

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q47)[na.exclude(mydata$eh_s9q47)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q47", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q47. Nets and other fishing equipment.  Lambat at ibang kagamitan sa pangingisda
##   -998      0     10     20     30     50     75    100    150    200    250    300    350    380    400    450    500    600    620    650    680    700    800    850 
##      1      5      1      2      2      6      2     13      1     10      1     10      2      1      1      1     24      1      1      1      2      2      6      1 
##   1000   1030   1200   1500   1520   1600   1700   1800   1900   1990   2000   2100   2300   2500   2700   2800   3000   3200   3500   3700   4000   4200   4500   5000 
##     24      1      4     25      1      3      4      1      1      1     21      1      1      6      1      1     24      1      7      1     12      1      1     21 
##   5250   5500   6000   7000   8000   8700   9500  10000  11000  11800  12000  13000  14000  15000  16000  18000  20000  25000  26000  30000  40000  50000  60000  72000 
##      1      1      8      4      4      1      1     29      2      1      3      1      1     13      2      1     10      5      1      4      2      3      1      1 
##  1e+05 150000  2e+05   <NA> 
##      2      1      1   1923

## [1] "Frequency table after encoding"
## eh_s9q47. Nets and other fishing equipment.  Lambat at ibang kagamitan sa pangingisda
##           -998              0             10             20             30             50             75            100            150            200            250 
##              1              5              1              2              2              6              2             13              1             10              1 
##            300            350            380            400            450            500            600            620            650            680            700 
##             10              2              1              1              1             24              1              1              1              2              2 
##            800            850           1000           1030           1200           1500           1520           1600           1700           1800           1900 
##              6              1             24              1              4             25              1              3              4              1              1 
##           1990           2000           2100           2300           2500           2700           2800           3000           3200           3500           3700 
##              1             21              1              1              6              1              1             24              1              7              1 
##           4000           4200           4500           5000           5250           5500           6000           7000           8000           8700           9500 
##             12              1              1             21              1              1              8              4              4              1              1 
##          10000          11000          11800          12000          13000          14000          15000          16000          18000          20000          25000 
##             29              2              1              3              1              1             13              2              1             10              5 
##          26000          30000          40000          50000          60000          72000          1e+05 109000 or more           <NA> 
##              1              4              2              3              1              1              2              2           1923

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q48)[na.exclude(mydata$eh_s9q48)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q48", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q48. Other business inventory and assets.  Ibang imbentaryo ng kalakal at mga ari-ari
##  -998     0     8    10    15    20    25    34    35    58    60   100   120   130   150   200   210   250   300   350   400   450   500   600   650   700   750   800 
##     1     6     2     1     1     5     2     1     1     1     1     6     1     1     2     5     1     2     3     1     2     2    10     2     1     3     1     3 
##   850   900  1000  1200  1500  1700  2000  2500  3000  4000  4200  4500  4800  5000  5800  7000  8000  9000  9500 10000 12000 13000 15000 22000 30000 35000 50000 70000 
##     1     1     5     1     4     1     8     2     1     5     1     1     1    10     1     1     1     2     1     5     2     1     2     1     4     1     2     1 
## 80000  <NA> 
##     2  2151

## [1] "Frequency table after encoding"
## eh_s9q48. Other business inventory and assets.  Ibang imbentaryo ng kalakal at mga ari-ari
##          -998             0             8            10            15            20            25            34            35            58            60           100 
##             1             6             2             1             1             5             2             1             1             1             1             6 
##           120           130           150           200           210           250           300           350           400           450           500           600 
##             1             1             2             5             1             2             3             1             2             2            10             2 
##           650           700           750           800           850           900          1000          1200          1500          1700          2000          2500 
##             1             3             1             3             1             1             5             1             4             1             8             2 
##          3000          4000          4200          4500          4800          5000          5800          7000          8000          9000          9500         10000 
##             1             5             1             1             1            10             1             1             1             2             1             5 
##         12000         13000         15000         22000         30000         35000         50000         70000 80000 or more          <NA> 
##             2             1             2             1             4             1             2             1             2          2151

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q50)[na.exclude(mydata$eh_s9q50)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q50", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q50. Q383: Cell Phone  Cellphone
##   -998      1      3      7     10     40     96    100    150    200    250    300    350    375    380    385    399    400    450    499    500    548    550    589 
##     10      1      2      1      1      1      1     11      1     23      4     54      5      1      1      1      3     30      2      3    162      1      3      1 
##    599    600    699    700    792    798    800    848    900    978    980    998    999   1000   1050   1100   1200   1250   1290   1300   1380   1400   1470   1480 
##      1     35      1     38      1      1     28      1     22      1      1      1      1    180      1      4     32      1      1     11      1     15      1      1 
##   1500   1600   1699   1700   1750   1800   1849   1850   1900   1914   1950   1999   2000   2030   2050   2100   2150   2200   2250   2300   2400   2480   2500   2508 
##    157     15      1     13      3     28      1      1     13      1      2      1    139      1      1     12      1     15      2      7     11      1     56      1 
##   2550   2600   2700   2799   2800   2880   2900   2950   3000   3050   3100   3150   3200   3250   3300   3400   3500   3599   3600   3696   3700   3800   3900   3950 
##      1      7     12      1      9      1      5      1    154      1      3      2      8      1      9      5     39      1      8      1      5      7      5      1 
##   4000   4100   4200   4300   4400   4495   4500   4600   4700   4800   4900   5000   5099   5100   5200   5300   5400   5500   5600   5700   5800   5900   6000   6100 
##    101      3      4      5      2      1     22      2      3      7      5     90      1      5      2      2      4     10      1      4      1      1     59      1 
##   6200   6300   6400   6500   6600   6700   6800   7000   7200   7400   7500   7600   7700   7800   8000   8200   8400   8450   8500   8600   8700   8800   8900   9000 
##      2      3      3      5      2      1      2     27      2      1      6      1      1      1     23      1      1      1      7      1      1      1      1     25 
##   9050   9200   9400   9420   9460   9500  10000  10200  10250  10300  10400  10500  10600  10900  11000  11100  11200  11300  11500  11600  12000  12100  12200  12500 
##      1      3      2      1      1      5     43      1      1      1      1      3      2      1     11      1      1      1      5      1     12      1      1      2 
##  13000  13500  14000  14400  14700  14999  15000  15500  15600  16000  16300  16600  16800  17000  17399  17800  18000  18200  19000  20000  20003  20700  20900  21000 
##      8      2      8      2      1      1     28      1      1      8      1      1      1      3      1      1      4      1      2      4      1      1      1      2 
##  21500  22000  22500  22800  23150  23700  24000  24800  25000  25500  26000  26700  27000  28000  29000  30000  32000  32500  33500  34000  34200  34450  35000  37000 
##      2      1      2      1      1      1      1      1      7      1      1      1      1      2      1      7      3      1      2      1      1      1      3      1 
##  39000  40000  40500  40600  50000 104000   <NA> 
##      1      4      1      1      1      1    121

## [1] "Frequency table after encoding"
## eh_s9q50. Q383: Cell Phone  Cellphone
##          -998             1             3             7            10            40            96           100           150           200           250           300 
##            10             1             2             1             1             1             1            11             1            23             4            54 
##           350           375           380           385           399           400           450           499           500           548           550           589 
##             5             1             1             1             3            30             2             3           162             1             3             1 
##           599           600           699           700           792           798           800           848           900           978           980           998 
##             1            35             1            38             1             1            28             1            22             1             1             1 
##           999          1000          1050          1100          1200          1250          1290          1300          1380          1400          1470          1480 
##             1           180             1             4            32             1             1            11             1            15             1             1 
##          1500          1600          1699          1700          1750          1800          1849          1850          1900          1914          1950          1999 
##           157            15             1            13             3            28             1             1            13             1             2             1 
##          2000          2030          2050          2100          2150          2200          2250          2300          2400          2480          2500          2508 
##           139             1             1            12             1            15             2             7            11             1            56             1 
##          2550          2600          2700          2799          2800          2880          2900          2950          3000          3050          3100          3150 
##             1             7            12             1             9             1             5             1           154             1             3             2 
##          3200          3250          3300          3400          3500          3599          3600          3696          3700          3800          3900          3950 
##             8             1             9             5            39             1             8             1             5             7             5             1 
##          4000          4100          4200          4300          4400          4495          4500          4600          4700          4800          4900          5000 
##           101             3             4             5             2             1            22             2             3             7             5            90 
##          5099          5100          5200          5300          5400          5500          5600          5700          5800          5900          6000          6100 
##             1             5             2             2             4            10             1             4             1             1            59             1 
##          6200          6300          6400          6500          6600          6700          6800          7000          7200          7400          7500          7600 
##             2             3             3             5             2             1             2            27             2             1             6             1 
##          7700          7800          8000          8200          8400          8450          8500          8600          8700          8800          8900          9000 
##             1             1            23             1             1             1             7             1             1             1             1            25 
##          9050          9200          9400          9420          9460          9500         10000         10200         10250         10300         10400         10500 
##             1             3             2             1             1             5            43             1             1             1             1             3 
##         10600         10900         11000         11100         11200         11300         11500         11600         12000         12100         12200         12500 
##             2             1            11             1             1             1             5             1            12             1             1             2 
##         13000         13500         14000         14400         14700         14999         15000         15500         15600         16000         16300         16600 
##             8             2             8             2             1             1            28             1             1             8             1             1 
##         16800         17000         17399         17800         18000         18200         19000         20000         20003         20700         20900         21000 
##             1             3             1             1             4             1             2             4             1             1             1             2 
##         21500         22000         22500         22800         23150         23700         24000         24800         25000         25500         26000         26700 
##             2             1             2             1             1             1             1             1             7             1             1             1 
##         27000         28000         29000         30000         32000         32500         33500         34000         34200         34450 35000 or more          <NA> 
##             1             2             1             7             3             1             2             1             1             1            13           121

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q51)[na.exclude(mydata$eh_s9q51)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q51", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q51. Q384: Sofa  Sofa
##  -998     0    20    30    50    75   100   150   200   208   250   300   400   450   500   600   700   800   900  1000  1100  1200  1300  1400  1500  1600  1635  1800 
##     4     5     2     1     5     1    21     4    32     1     5    25     4     1    77     5     8    12     5    61     1     8     3     1    61     1     1     2 
##  1900  2000  2100  2200  2300  2400  2500  2600  2700  2800  2900  3000  3100  3200  3300  3400  3500  3700  3800  3900  4000  4400  4500  4600  4800  5000  5500  5700 
##     1    56     2     1     5     3    23     1     4     4     1    27     1     3     1     4     8     2     2     1    18     1     6     1     1    30     1     1 
##  5900  6000  6500  6600  6800  7000  7200  7500  7900  8000  9000  9500 10000 11000 12000 15000 16000 18000 19000 20000 24000 25000 30000 50000  <NA> 
##     1    11     3     1     1     7     1     2     1     5     4     1    12     2     7     5     2     1     1     1     1     1     2     1  1648

## [1] "Frequency table after encoding"
## eh_s9q51. Q384: Sofa  Sofa
##          -998             0            20            30            50            75           100           150           200           208           250           300 
##             4             5             2             1             5             1            21             4            32             1             5            25 
##           400           450           500           600           700           800           900          1000          1100          1200          1300          1400 
##             4             1            77             5             8            12             5            61             1             8             3             1 
##          1500          1600          1635          1800          1900          2000          2100          2200          2300          2400          2500          2600 
##            61             1             1             2             1            56             2             1             5             3            23             1 
##          2700          2800          2900          3000          3100          3200          3300          3400          3500          3700          3800          3900 
##             4             4             1            27             1             3             1             4             8             2             2             1 
##          4000          4400          4500          4600          4800          5000          5500          5700          5900          6000          6500          6600 
##            18             1             6             1             1            30             1             1             1            11             3             1 
##          6800          7000          7200          7500          7900          8000          9000          9500         10000         11000         12000         15000 
##             1             7             1             2             1             5             4             1            12             2             7             5 
##         16000         18000         19000         20000         24000 24804 or more          <NA> 
##             2             1             1             1             1             4          1648

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q52)[na.exclude(mydata$eh_s9q52)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q52", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q52. Q385: Chairs  Mga silya
##  -998     0     4     5    10    15    20    24    25    30    40    50    58    60    70    75    80    90   100   110   120   125   130   135   140   150   160   180 
##    15    13     1     2     8     2    20     1     1     8    15    63     1     8     5     3     5     4   155     1     8     1     1     1     1    72     5     1 
##   190   195   200   210   220   225   226   230   240   250   260   270   275   280   285   300   320   330   340   350   360   380   400   405   410   420   435   450 
##     1     1   146     1     1     3     1     1     2    28     3     1     2     3     1   141     3     2     1     9     6     1    83     1     1     1     1    30 
##   460   480   500   510   520   540   550   575   600   620   630   640   650   680   690   694   700   720   750   800   825   840   850   860   875   900   920   950 
##     2     4   146     1     2     2     2     1    87     1     2     2     5     1     2     1    22     2    19    59     1     2     3     1     1    23     1     1 
##   960   969  1000  1020  1050  1060  1072  1080  1100  1120  1140  1150  1200  1220  1240  1250  1280  1300  1325  1350  1400  1450  1500  1520  1560  1600  1620  1650 
##     2     1   120     1     6     1     1     2     2     1     1     1    39     1     1     7     1     3     1     1    13     1    67     1     1     9     1     3 
##  1680  1700  1750  1790  1800  1860  1900  1920  1980  2000  2100  2200  2240  2250  2280  2300  2340  2350  2400  2450  2500  2600  2700  2800  2880  2900  3000  3100 
##     6     8     1     1    24     1     1     1     1    37     4     5     1     1     2     1     1     1     7     2    24     4     6     6     1     2    20     1 
##  3225  3500  3600  3700  3800  3990  4000  4500  4600  4800  5000  5400  5500  6000  6500  7000  7300  7500  8000  8400 10000 11000 15000 16000 20000  <NA> 
##     1     6     1     4     2     1    12     3     1     1    12     1     1     4     2     1     1     1     1     1     5     1     2     1     1   470

## [1] "Frequency table after encoding"
## eh_s9q52. Q385: Chairs  Mga silya
##         -998            0            4            5           10           15           20           24           25           30           40           50 
##           15           13            1            2            8            2           20            1            1            8           15           63 
##           58           60           70           75           80           90          100          110          120          125          130          135 
##            1            8            5            3            5            4          155            1            8            1            1            1 
##          140          150          160          180          190          195          200          210          220          225          226          230 
##            1           72            5            1            1            1          146            1            1            3            1            1 
##          240          250          260          270          275          280          285          300          320          330          340          350 
##            2           28            3            1            2            3            1          141            3            2            1            9 
##          360          380          400          405          410          420          435          450          460          480          500          510 
##            6            1           83            1            1            1            1           30            2            4          146            1 
##          520          540          550          575          600          620          630          640          650          680          690          694 
##            2            2            2            1           87            1            2            2            5            1            2            1 
##          700          720          750          800          825          840          850          860          875          900          920          950 
##           22            2           19           59            1            2            3            1            1           23            1            1 
##          960          969         1000         1020         1050         1060         1072         1080         1100         1120         1140         1150 
##            2            1          120            1            6            1            1            2            2            1            1            1 
##         1200         1220         1240         1250         1280         1300         1325         1350         1400         1450         1500         1520 
##           39            1            1            7            1            3            1            1           13            1           67            1 
##         1560         1600         1620         1650         1680         1700         1750         1790         1800         1860         1900         1920 
##            1            9            1            3            6            8            1            1           24            1            1            1 
##         1980         2000         2100         2200         2240         2250         2280         2300         2340         2350         2400         2450 
##            1           37            4            5            1            1            2            1            1            1            7            2 
##         2500         2600         2700         2800         2880         2900         3000         3100         3225         3500         3600         3700 
##           24            4            6            6            1            2           20            1            1            6            1            4 
##         3800         3990         4000         4500         4600         4800         5000         5400         5500         6000         6500         7000 
##            2            1           12            3            1            1           12            1            1            4            2            1 
##         7300         7500         8000         8400 9863 or more         <NA> 
##            1            1            1            1           10          470

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q53)[na.exclude(mydata$eh_s9q53)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q53", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q53. Q386: Table  Lamesa
##  -998     0     2     4     5    10    12    20    22    28    30    35    40    50    60    70    80   100   120   150   180   200   208   210   220   225   230   250 
##    14    24     1     1     1     3     1    15     1     1    11     1     1    94     3     1     3   242     1    88     2   290     1     1     1     1     1    25 
##   300   350   360   380   400   450   480   500   550   600   650   670   700   750   800   850   900   950   998  1000  1010  1050  1100  1150  1200  1300  1360  1400 
##   196    15     2     1    69     9     1   282     9    79     3     1    44     7    35     4    11     1     1   183     1     1     5     1    22     4     1     5 
##  1500  1600  1700  1750  1800  1840  2000  2100  2200  2400  2500  2550  2700  3000  3200  3500  3550  3800  4000  4500  5000  5300  5400  5500  6000  6500  7000  8000 
##    74     4     4     1     6     1    45     1     2     4    14     1     1    29     3     5     1     2    11     1    15     1     1     1    10     1     3     2 
##  9000 10000 10500 11800 12000 13000 15000 17000 18000 20000 27000 44500 70000  <NA> 
##     1     5     1     1     3     1     2     2     1     1     1     1     1   201

## [1] "Frequency table after encoding"
## eh_s9q53. Q386: Table  Lamesa
##          -998             0             2             4             5            10            12            20            22            28            30            35 
##            14            24             1             1             1             3             1            15             1             1            11             1 
##            40            50            60            70            80           100           120           150           180           200           208           210 
##             1            94             3             1             3           242             1            88             2           290             1             1 
##           220           225           230           250           300           350           360           380           400           450           480           500 
##             1             1             1            25           196            15             2             1            69             9             1           282 
##           550           600           650           670           700           750           800           850           900           950           998          1000 
##             9            79             3             1            44             7            35             4            11             1             1           183 
##          1010          1050          1100          1150          1200          1300          1360          1400          1500          1600          1700          1750 
##             1             1             5             1            22             4             1             5            74             4             4             1 
##          1800          1840          2000          2100          2200          2400          2500          2550          2700          3000          3200          3500 
##             6             1            45             1             2             4            14             1             1            29             3             5 
##          3550          3800          4000          4500          5000          5300          5400          5500          6000          6500          7000          8000 
##             1             2            11             1            15             1             1             1            10             1             3             2 
##          9000         10000         10500         11800 12000 or more          <NA> 
##             1             5             1             1            13           201

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q54)[na.exclude(mydata$eh_s9q54)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q54", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q54. Q387: Clock/Watch  Relo
##  -999  -998     0     1     5    10    15    20    25    28    30    35    40    45    50    55    60    65    70    75    80    85    89    90    95   100   110   120 
##     1     5    12     1     1     1     1    12     1     1    14     2     2     1   109     2    14     7     5    11    15     4     1     3     1   261     3    36 
##   125   130   135   139   140   150   160   170   175   180   198   200   205   220   230   240   250   255   265   289   290   299   300   310   315   320   330   350 
##     1     9     2     1     3   177     4     1     4     6     1   128     1     1     2     3    40     1     1     1     1     1    91     1     1     1     1    15 
##   360   380   390   400   420   430   450   475   490   500   550   580   600   648   650   660   700   720   725   750   800   805   850   870   900  1000  1050  1080 
##     2     1     2    31     2     1     7     1     1    69     4     1    25     1     3     1    11     1     1     5    12     1     2     1     3    44     2     1 
##  1100  1108  1150  1200  1250  1300  1400  1450  1500  1600  1650  1700  1800  1900  1920  2000  2020  2050  2150  2250  2300  2350  2450  2500  2600  2650  2700  2799 
##     5     1     4     4     1     2     1     1    31     4     3     2     2     1     1    17     1     1     1     1     1     1     1     5     1     1     1     1 
##  2800  2900  3000  3150  3200  3500  3750  4000  4120  4150  4400  4500  4650  5000  5200  5250  5500  6000  7000  7550  8050  8200  8400  9000 10000 10200 10300 11700 
##     1     1    14     1     1     3     1     8     1     1     1     2     1     7     1     1     1     3     2     1     1     1     1     2     1     1     1     1 
## 15000 17700 18780 20000  <NA> 
##     1     1     1     1   865

## [1] "Frequency table after encoding"
## eh_s9q54. Q387: Clock/Watch  Relo
##         -999         -998            0            1            5           10           15           20           25           28           30           35 
##            1            5           12            1            1            1            1           12            1            1           14            2 
##           40           45           50           55           60           65           70           75           80           85           89           90 
##            2            1          109            2           14            7            5           11           15            4            1            3 
##           95          100          110          120          125          130          135          139          140          150          160          170 
##            1          261            3           36            1            9            2            1            3          177            4            1 
##          175          180          198          200          205          220          230          240          250          255          265          289 
##            4            6            1          128            1            1            2            3           40            1            1            1 
##          290          299          300          310          315          320          330          350          360          380          390          400 
##            1            1           91            1            1            1            1           15            2            1            2           31 
##          420          430          450          475          490          500          550          580          600          648          650          660 
##            2            1            7            1            1           69            4            1           25            1            3            1 
##          700          720          725          750          800          805          850          870          900         1000         1050         1080 
##           11            1            1            5           12            1            2            1            3           44            2            1 
##         1100         1108         1150         1200         1250         1300         1400         1450         1500         1600         1650         1700 
##            5            1            4            4            1            2            1            1           31            4            3            2 
##         1800         1900         1920         2000         2020         2050         2150         2250         2300         2350         2450         2500 
##            2            1            1           17            1            1            1            1            1            1            1            5 
##         2600         2650         2700         2799         2800         2900         3000         3150         3200         3500         3750         4000 
##            1            1            1            1            1            1           14            1            1            3            1            8 
##         4120         4150         4400         4500         4650         5000         5200         5250         5500         6000         7000         7550 
##            1            1            1            2            1            7            1            1            1            3            2            1 
##         8050         8200         8400         9000 9890 or more         <NA> 
##            1            1            1            2            8          865

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q55)[na.exclude(mydata$eh_s9q55)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q55", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q55. Q388: Bicycle  Bisekleta
##  -998     0     1    21    30    50   100   120   150   200   250   300   400   500   600   700   750   800   900  1000  1008  1100  1200  1300  1400  1500  1600  1700 
##     1     3     1     1     1     2     4     1     1     9     2    22     5    74     9    17     2    19     3    77     1     1    15     2     1    64     3     3 
##  1800  1900  2000  2025  2200  2300  2400  2500  2600  2700  2800  3000  3200  3400  3500  3600  3700  3800  4000  4200  4500  4700  5000  5400  5500  5800  6000  6500 
##    10     1    47     1     3     4     4    34     2     8     7    36     2     2    12     1     1     1    12     1     2     1    22     1     1     1     1     3 
##  6700  7000  7500  8000  8500  9500 10000 11000 11200 11500 12000 13000 15000 16000 20000 21000 74000  <NA> 
##     1     4     4     2     1     1     3     1     1     1     1     2     1     1     2     1     1  1695

## [1] "Frequency table after encoding"
## eh_s9q55. Q388: Bicycle  Bisekleta
##          -998             0             1            21            30            50           100           120           150           200           250           300 
##             1             3             1             1             1             2             4             1             1             9             2            22 
##           400           500           600           700           750           800           900          1000          1008          1100          1200          1300 
##             5            74             9            17             2            19             3            77             1             1            15             2 
##          1400          1500          1600          1700          1800          1900          2000          2025          2200          2300          2400          2500 
##             1            64             3             3            10             1            47             1             3             4             4            34 
##          2600          2700          2800          3000          3200          3400          3500          3600          3700          3800          4000          4200 
##             2             8             7            36             2             2            12             1             1             1            12             1 
##          4500          4700          5000          5400          5500          5800          6000          6500          6700          7000          7500          8000 
##             2             1            22             1             1             1             1             3             1             4             4             2 
##          8500          9500         10000         11000         11200         11500         12000         13000         15000         16000 20000 or more          <NA> 
##             1             1             3             1             1             1             1             2             1             1             4          1695

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q56)[na.exclude(mydata$eh_s9q56)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q56", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q56. Q389: Tricycle  Tricycle
##   -998   1500   2000   3000   4000   4400   5000   6000   7000   8000   9000  10000  12000  14000  15000  20000  22000  23000  24000  25000  28000  30000  32000  35000 
##      1      1      1      3      1      1      5      2      3      2      1     14      5      2     13     17      1      2      2     13      1     20      1     14 
##  36000  40000  45000  48000  49000  49600  50000  55000  56340  59400  60000  63000  65000  68000  70000  72000  74000  75000  76800  80000  82380  82800  83808  84000 
##      2     12     10      1      2      1     27      3      1      1      4      1      1      1     10      2      2      1      1      2      1      1      1      1 
##  85000  86400  90000  98000  1e+05 110000 115000 120000 124000 130000 131000 132000 133200 147000 149000 150000 153000 160000 188000 195000  2e+05   <NA> 
##      1      1      1      1     10      2      1      2      1      2      1      1      1      1      1      4      1      2      1      1      3   2034

## [1] "Frequency table after encoding"
## eh_s9q56. Q389: Tricycle  Tricycle
##          -998          1500          2000          3000          4000          4400          5000          6000          7000          8000          9000         10000 
##             1             1             1             3             1             1             5             2             3             2             1            14 
##         12000         14000         15000         20000         22000         23000         24000         25000         28000         30000         32000         35000 
##             5             2            13            17             1             2             2            13             1            20             1            14 
##         36000         40000         45000         48000         49000         49600         50000         55000         56340         59400         60000         63000 
##             2            12            10             1             2             1            27             3             1             1             4             1 
##         65000         68000         70000         72000         74000         75000         76800         80000         82380         82800         83808         84000 
##             1             1            10             2             2             1             1             2             1             1             1             1 
##         85000         86400         90000         98000         1e+05        110000        115000        120000        124000        130000        131000        132000 
##             1             1             1             1            10             2             1             2             1             2             1             1 
##        133200        147000        149000        150000        153000        160000        188000        195000 2e+05 or more          <NA> 
##             1             1             1             4             1             2             1             1             3          2034

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q57)[na.exclude(mydata$eh_s9q57)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q57", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q57. Q390: Motorbike  Motor
##   -999   -998      0     20     47    500   1000   1800   2000   2500   3000   3300   3500   4000   4500   4900   5000   6000   6500   7000   7500   8000   9000  10000 
##      1      4      1      1      1      1      5      1      4      1      6      1      1      5      1      1     32      5      1     10      1      9      4     64 
##  10200  10500  10800  11000  12000  12500  13000  14000  15000  15500  16000  17000  18000  20000  22000  23000  23100  24000  25000  27000  28000  30000  31000  32000 
##      1      1      1      1     12      1      1      3     47      1      2      3      6     46      7      2      1      5     24      3      2     36      1      1 
##  33000  35000  36000  36250  37000  38000  39000  39600  40000  42000  44000  45000  45600  46000  46800  47000  47800  48000  49000  50000  50400  51000  52000  54000 
##      1     13      3      1      3      2      2      1     27      2      2     13      1      4      2      1      1      1      1     20      1      1      1      8 
##  55000  57000  57600  58000  60000  60300  61200  62000  63000  63500  64000  64200  65000  66060  68000  68400  68580  69000  69600  70000  71000  72000  74000  74800 
##      1      1      1      1     23      2      2      3      2      1      2      1      6      1      1      1      1      1      1     18      2      3      1      1 
##  75000  75060  75600  76000  77000  77250  78000  79000  80000  80500  81000  82000  83000  85000  86400  89000  89244  89800  90000  90840  97000  97200  1e+05 102000 
##      8      1      1      2      2      1      2      1     14      1      1      2      1      2      1      1      1      1      7      1      1      1     12      1 
## 103536 104000 111492 112000 115000 116200 117000 117180 120000 132000 143000 146000 150000 180000 186000  2e+05 213348 220000 230000 287000 360000   <NA> 
##      1      1      1      1      1      1      1      1      7      1      1      1      2      1      1      1      1      1      1      1      1   1636

## [1] "Frequency table after encoding"
## eh_s9q57. Q390: Motorbike  Motor
##           -999           -998              0             20             47            500           1000           1800           2000           2500           3000 
##              1              4              1              1              1              1              5              1              4              1              6 
##           3300           3500           4000           4500           4900           5000           6000           6500           7000           7500           8000 
##              1              1              5              1              1             32              5              1             10              1              9 
##           9000          10000          10200          10500          10800          11000          12000          12500          13000          14000          15000 
##              4             64              1              1              1              1             12              1              1              3             47 
##          15500          16000          17000          18000          20000          22000          23000          23100          24000          25000          27000 
##              1              2              3              6             46              7              2              1              5             24              3 
##          28000          30000          31000          32000          33000          35000          36000          36250          37000          38000          39000 
##              2             36              1              1              1             13              3              1              3              2              2 
##          39600          40000          42000          44000          45000          45600          46000          46800          47000          47800          48000 
##              1             27              2              2             13              1              4              2              1              1              1 
##          49000          50000          50400          51000          52000          54000          55000          57000          57600          58000          60000 
##              1             20              1              1              1              8              1              1              1              1             23 
##          60300          61200          62000          63000          63500          64000          64200          65000          66060          68000          68400 
##              2              2              3              2              1              2              1              6              1              1              1 
##          68580          69000          69600          70000          71000          72000          74000          74800          75000          75060          75600 
##              1              1              1             18              2              3              1              1              8              1              1 
##          76000          77000          77250          78000          79000          80000          80500          81000          82000          83000          85000 
##              2              2              1              2              1             14              1              1              2              1              2 
##          86400          89000          89244          89800          90000          90840          97000          97200          1e+05         102000         103536 
##              1              1              1              1              7              1              1              1             12              1              1 
##         104000         111492         112000         115000         116200         117000         117180         120000         132000         143000         146000 
##              1              1              1              1              1              1              1              7              1              1              1 
##         150000         180000         186000          2e+05         213348 218303 or more           <NA> 
##              2              1              1              1              1              4           1636

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q58)[na.exclude(mydata$eh_s9q58)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q58", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q58. Q391: Motorized Boat/Banca  Bangkang de-makina/ bangka
##      0     46    500   1000   1500   2500   4000   4500   5000   5600   6000   7000   8000   9000  10000  12000  12008  13000  14000  15000  16000  17000  18000  20000 
##      1      1      1      1      3      1      1      1      4      1      1      3      1      1      5      2      1      4      1     10      2      1      2     17 
##  20500  22000  23000  25000  27000  29000  30000  35000  40000  45000  50000  55000  60000  64000  68000  70000  80000  90000  95000 160000   <NA> 
##      1      1      2      9      1      1      8      2      5      6     11      1      1      1      1      2      1      2      1      1   2164

## [1] "Frequency table after encoding"
## eh_s9q58. Q391: Motorized Boat/Banca  Bangkang de-makina/ bangka
##              0             46            500           1000           1500           2500           4000           4500           5000           5600           6000 
##              1              1              1              1              3              1              1              1              4              1              1 
##           7000           8000           9000          10000          12000          12008          13000          14000          15000          16000          17000 
##              3              1              1              5              2              1              4              1             10              2              1 
##          18000          20000          20500          22000          23000          25000          27000          29000          30000          35000          40000 
##              2             17              1              1              2              9              1              1              8              2              5 
##          45000          50000          55000          60000          64000          68000          70000          80000          90000          95000 120025 or more 
##              6             11              1              1              1              1              2              1              2              1              1 
##           <NA> 
##           2164

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q59)[na.exclude(mydata$eh_s9q59)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q59", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q59. Q392: Other Motorized Vehicle  Iba pang sasakyang de-motor
##   2000   8000  12000  22000  39000  47000  55000  70000  90000  1e+05 120000 150000  2e+05 750000   <NA> 
##      1      2      1      1      1      1      1      1      1      3      2      1      2      1   2269

## [1] "Frequency table after encoding"
## eh_s9q59. Q392: Other Motorized Vehicle  Iba pang sasakyang de-motor
##           2000           8000          12000          22000          39000          47000          55000          70000          90000          1e+05         120000 
##              1              2              1              1              1              1              1              1              1              3              2 
##         150000          2e+05 700500 or more           <NA> 
##              1              2              1           2269

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q60)[na.exclude(mydata$eh_s9q60)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q60", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q60. Q393: Radio, Tape, or CD Player  Radyo, Tape o CD Player
##  -998     0    20    50    75   100   120   150   180   200   208   250   270   280   300   320   350   360   390   399   400   450   480   499   500   550   570   600 
##     6     6     2     8     1    42     2    23     4    32     1    27     1     3    79     3    18     1     1     1    25    15     2     1   131     2     1    22 
##   650   700   750   800   850   899   900  1000  1005  1050  1100  1200  1300  1400  1500  1600  1700  1800  2000  2100  2200  2300  2400  2500  2700  2800  3000  3200 
##     1    26     1    22     1     1     5   118     1     1    11    21     4     2    80     5     7     8    40     3     3     1     4    28     3     8    28     1 
##  3300  3400  3500  3700  3800  4000  4200  4300  4450  4500  4800  5000  5300  5600  6000  7000  7500  8000  9000 10000 10800 12000 14000 15000 20000 24000 29000  <NA> 
##     2     1    10     1     1    13     2     1     1     7     1    22     1     1     5     4     1     3     1    11     1     2     1     1     1     1     1  1297

## [1] "Frequency table after encoding"
## eh_s9q60. Q393: Radio, Tape, or CD Player  Radyo, Tape o CD Player
##          -998             0            20            50            75           100           120           150           180           200           208           250 
##             6             6             2             8             1            42             2            23             4            32             1            27 
##           270           280           300           320           350           360           390           399           400           450           480           499 
##             1             3            79             3            18             1             1             1            25            15             2             1 
##           500           550           570           600           650           700           750           800           850           899           900          1000 
##           131             2             1            22             1            26             1            22             1             1             5           118 
##          1005          1050          1100          1200          1300          1400          1500          1600          1700          1800          2000          2100 
##             1             1            11            21             4             2            80             5             7             8            40             3 
##          2200          2300          2400          2500          2700          2800          3000          3200          3300          3400          3500          3700 
##             3             1             4            28             3             8            28             1             2             1            10             1 
##          3800          4000          4200          4300          4450          4500          4800          5000          5300          5600          6000          7000 
##             1            13             2             1             1             7             1            22             1             1             5             4 
##          7500          8000          9000         10000         10800         12000 12099 or more          <NA> 
##             1             3             1            11             1             2             5          1297

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q61)[na.exclude(mydata$eh_s9q61)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q61", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q61. Q394: Beds  Mga kama
##  -998     0     5    10    20    50    75    80   100   120   150   160   200   250   300   350   360   400   450   500   600   650   700   750   800   900   950  1000 
##    11    14     1     1     3    12     3     1    36     1    23     1    93    11    99     5     1    39     1   180    59     2    19     1    24    13     1   131 
##  1050  1100  1200  1300  1400  1500  1600  1700  1800  1900  2000  2100  2200  2400  2500  2600  2800  3000  3200  3300  3500  3600  4000  4500  5000  5200  5300  6000 
##     1     1    17     5     5    74     2     1     6     1    67     2     1     3    21     1     1    51     1     1    13     2    18     5    24     1     1     9 
##  6500  7000  7500  8000  9000 10000 10003 10300 10500 10600 11000 12000 13500 15000 20000 23000 24000 25000 25070 27000 32000 40000  <NA> 
##     4     6     1     7     2    11     1     1     1     1     1     2     1     5     1     1     1     1     1     1     1     1  1115

## [1] "Frequency table after encoding"
## eh_s9q61. Q394: Beds  Mga kama
##          -998             0             5            10            20            50            75            80           100           120           150           160 
##            11            14             1             1             3            12             3             1            36             1            23             1 
##           200           250           300           350           360           400           450           500           600           650           700           750 
##            93            11            99             5             1            39             1           180            59             2            19             1 
##           800           900           950          1000          1050          1100          1200          1300          1400          1500          1600          1700 
##            24            13             1           131             1             1            17             5             5            74             2             1 
##          1800          1900          2000          2100          2200          2400          2500          2600          2800          3000          3200          3300 
##             6             1            67             2             1             3            21             1             1            51             1             1 
##          3500          3600          4000          4500          5000          5200          5300          6000          6500          7000          7500          8000 
##            13             2            18             5            24             1             1             9             4             6             1             7 
##          9000         10000         10003         10300         10500         10600         11000         12000         13500         15000         20000         23000 
##             2            11             1             1             1             1             1             2             1             5             1             1 
## 23140 or more          <NA> 
##             6          1115

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q62)[na.exclude(mydata$eh_s9q62)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q62", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q62. Q395: Mattresses  Mga kutson ng kama
##  -998     0    10    20    50   100   125   150   200   250   300   350   380   400   450   480   500   600   700   750   800   850   900   950  1000  1100  1200  1300 
##     9    19     1     1    15    38     1    11    49     6    46     4     1    17     2     1   112    21    12     2    27     1     5     1   156     5    26    10 
##  1350  1400  1500  1600  1700  1800  1900  2000  2002  2100  2200  2250  2300  2400  2500  2600  2700  2800  2900  3000  3050  3200  3300  3302  3400  3500  3600  3700 
##     1     6    77    14     5    19     4    98     1     1     2     1     3    10    40     6     5     4     1    76     1     9     4     1     2    25     2     1 
##  3800  4000  4050  4350  4400  4500  4570  4600  4700  4800  4900  5000  5100  5300  5400  5500  5600  5800  6000  6300  6400  7000  7100  7200  7300  7500  7600  8000 
##     5    29     1     1     2    14     1     2     1     7     2    41     2     1     5     4     3     3    29     2     2     7     1     2     1     2     1     8 
##  8500  9000  9500  9700 10000 10800 11000 11600 12000 12500 12900 13000 13500 14700 15000 81000  <NA> 
##     3     5     2     1     8     1     3     1     2     1     1     1     1     1     2     1  1057

## [1] "Frequency table after encoding"
## eh_s9q62. Q395: Mattresses  Mga kutson ng kama
##          -998             0            10            20            50           100           125           150           200           250           300           350 
##             9            19             1             1            15            38             1            11            49             6            46             4 
##           380           400           450           480           500           600           700           750           800           850           900           950 
##             1            17             2             1           112            21            12             2            27             1             5             1 
##          1000          1100          1200          1300          1350          1400          1500          1600          1700          1800          1900          2000 
##           156             5            26            10             1             6            77            14             5            19             4            98 
##          2002          2100          2200          2250          2300          2400          2500          2600          2700          2800          2900          3000 
##             1             1             2             1             3            10            40             6             5             4             1            76 
##          3050          3200          3300          3302          3400          3500          3600          3700          3800          4000          4050          4350 
##             1             9             4             1             2            25             2             1             5            29             1             1 
##          4400          4500          4570          4600          4700          4800          4900          5000          5100          5300          5400          5500 
##             2            14             1             2             1             7             2            41             2             1             5             4 
##          5600          5800          6000          6300          6400          7000          7100          7200          7300          7500          7600          8000 
##             3             3            29             2             2             7             1             2             1             2             1             8 
##          8500          9000          9500          9700         10000         10800         11000         11600         12000         12500 12839 or more          <NA> 
##             3             5             2             1             8             1             3             1             2             1             7          1057

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q63)[na.exclude(mydata$eh_s9q63)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q63", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q63. Q396: Solar Panel  Solar Panel
##     0   100   150   200   240   250   300   360   400   500   700  1000  1400  1500  2000  2500  2600  3000  3500  4400  8500  9000 15500  <NA> 
##     1     1     2     5     1     1     5     1     1     3     3     1     1     5     3     1     1     4     1     1     1     1     1  2243

## [1] "Frequency table after encoding"
## eh_s9q63. Q396: Solar Panel  Solar Panel
##             0           100           150           200           240           250           300           360           400           500           700          1000 
##             1             1             2             5             1             1             5             1             1             3             3             1 
##          1400          1500          2000          2500          2600          3000          3500          4400          8500          9000 14070 or more          <NA> 
##             1             5             3             1             1             4             1             1             1             1             1          2243

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q64)[na.exclude(mydata$eh_s9q64)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q64", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q64. Q397: Generator  Generator
##  5000  6000 10000 11000 12000 15000 18000 23000  <NA> 
##     2     3     2     1     1     1     1     1  2276

## [1] "Frequency table after encoding"
## eh_s9q64. Q397: Generator  Generator
##          5000          6000         10000         11000         12000         15000         18000 22725 or more          <NA> 
##             2             3             2             1             1             1             1             1          2276

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q65)[na.exclude(mydata$eh_s9q65)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q65", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q65. Q398: Television  TV
##  -998     0     2    20    50   100   150   200   300   330   400   450   500   600   700   800   850   900  1000  1100  1200  1300  1400  1500  1550  1600  1650  1700 
##     6     5     2     1     1    10     3    14    15     1     3     1   111     7    19    16     1     1   188     2    45     7     8   207     1    21     1    23 
##  1750  1800  1900  2000  2100  2200  2300  2400  2500  2600  2700  2800  2900  3000  3100  3200  3250  3300  3400  3500  3700  3800  4000  4100  4300  4500  4700  4800 
##     1    47     9   187     6    27    14    10   105     6     7    11     2   135     2     7     1     2     1    40     3     3    62     3     1    14     1     1 
##  4900  5000  5200  5300  5400  5500  5700  6000  6500  6700  7000  7200  7500  7700  7800  8000  8500  8700  8800  8900  9000  9500  9600  9800  9999 10000 11000 12000 
##     2    96     1     2     1     6     1    33     6     1    26     2     2     1     1    25     2     1     1     1     3     2     1     1     1    33     8    20 
## 12500 12600 12960 13000 13500 13800 14000 15000 16000 16500 18000 19000 19500 20000 21000 22000 23500 24000 25000 27000 28000 30000 32000 33000 35000 36000  <NA> 
##     1     1     1    12     2     1     6    15     5     2     5     3     2     7     3     1     2     2     5     1     2     1     2     1     1     2   494

## [1] "Frequency table after encoding"
## eh_s9q65. Q398: Television  TV
##          -998             0             2            20            50           100           150           200           300           330           400           450 
##             6             5             2             1             1            10             3            14            15             1             3             1 
##           500           600           700           800           850           900          1000          1100          1200          1300          1400          1500 
##           111             7            19            16             1             1           188             2            45             7             8           207 
##          1550          1600          1650          1700          1750          1800          1900          2000          2100          2200          2300          2400 
##             1            21             1            23             1            47             9           187             6            27            14            10 
##          2500          2600          2700          2800          2900          3000          3100          3200          3250          3300          3400          3500 
##           105             6             7            11             2           135             2             7             1             2             1            40 
##          3700          3800          4000          4100          4300          4500          4700          4800          4900          5000          5200          5300 
##             3             3            62             3             1            14             1             1             2            96             1             2 
##          5400          5500          5700          6000          6500          6700          7000          7200          7500          7700          7800          8000 
##             1             6             1            33             6             1            26             2             2             1             1            25 
##          8500          8700          8800          8900          9000          9500          9600          9800          9999         10000         11000         12000 
##             2             1             1             1             3             2             1             1             1            33             8            20 
##         12500         12600         12960         13000         13500         13800         14000         15000         16000         16500         18000         19000 
##             1             1             1            12             2             1             6            15             5             2             5             3 
##         19500         20000         21000         22000         23500         24000         25000         27000 27035 or more          <NA> 
##             2             7             3             1             2             2             5             1             9           494

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q66)[na.exclude(mydata$eh_s9q66)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q66", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q66. Q399: VCR/DVD  VCR/DVD
##  -998     0    30   100   150   200   250   300   400   500   600   650   700   800   900  1000  1100  1150  1200  1300  1400  1500  1600  1700  1800  1900  2000  2100 
##     5     2     1     5     2     9     2    15     5    75     2     1    20    19     5    99     5     1    54    12     5   137    13     9    19     4    39     3 
##  2200  2300  2400  2500  2600  2800  3000  3200  3400  3500  3800  4000  4500  5000  5500  5700  6000  7000  8000 10000 11000 12000 14000 15000 18500 26000  <NA> 
##     4     1     1    28     1     3    25     1     1     4     1     5     2     8     1     1     4     1     4     4     1     1     1     2     1     1  1613

## [1] "Frequency table after encoding"
## eh_s9q66. Q399: VCR/DVD  VCR/DVD
##          -998             0            30           100           150           200           250           300           400           500           600           650 
##             5             2             1             5             2             9             2            15             5            75             2             1 
##           700           800           900          1000          1100          1150          1200          1300          1400          1500          1600          1700 
##            20            19             5            99             5             1            54            12             5           137            13             9 
##          1800          1900          2000          2100          2200          2300          2400          2500          2600          2800          3000          3200 
##            19             4            39             3             4             1             1            28             1             3            25             1 
##          3400          3500          3800          4000          4500          5000          5500          5700          6000          7000          8000         10000 
##             1             4             1             5             2             8             1             1             4             1             4             4 
##         11000         12000         14000 14629 or more          <NA> 
##             1             1             1             4          1613

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q67)[na.exclude(mydata$eh_s9q67)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q67", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q67. Q400: Computer  Computer
##  -998     0  1000  2000  2800  3000  3500  5000  6000  7000  8000  8500  9500 10000 11000 12000 13000 14000 15000 16000 16500 17000 18000 20000 21000 22000 24000 25000 
##     3     1     1     2     1     5     2     8     1     3     3     1     1    11     2     4     1     2     6     1     2     2     2     3     1     1     2     2 
## 30000 42000 45000 59000 60000 70000  <NA> 
##     1     1     1     1     1     1  2208

## [1] "Frequency table after encoding"
## eh_s9q67. Q400: Computer  Computer
##          -998             0          1000          2000          2800          3000          3500          5000          6000          7000          8000          8500 
##             3             1             1             2             1             5             2             8             1             3             3             1 
##          9500         10000         11000         12000         13000         14000         15000         16000         16500         17000         18000         20000 
##             1            11             2             4             1             2             6             1             2             2             2             3 
##         21000         22000         24000         25000         30000         42000         45000         59000         60000 66050 or more          <NA> 
##             1             1             2             2             1             1             1             1             1             1          2208

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q68)[na.exclude(mydata$eh_s9q68)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q68", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q68. Q402: Wheelbarrow  Wheelbarrow
##   200   300   450   500   600  1000  2000  2500  3000  4000  4500  5000  6000  7000  8000 15000  <NA> 
##     1     1     1     1     1     3     1     2     1     1     1     1     2     3     1     1  2266

## [1] "Frequency table after encoding"
## eh_s9q68. Q402: Wheelbarrow  Wheelbarrow
##           200           300           450           500           600          1000          2000          2500          3000          4000          4500          5000 
##             1             1             1             1             1             3             1             2             1             1             1             1 
##          6000          7000          8000 14264 or more          <NA> 
##             2             3             1             1          2266

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q69)[na.exclude(mydata$eh_s9q69)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q69", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q69. Q403: Cart  Kariton
##     0   100   150   200   250   300   350   500   600  1000  1200  1500  2000  2500  3000  3500  4000  4500  5000  5500  6000  7000  8000  9000 10000 12000 13000 15000 
##     1     4     2     3     1     7     1     3     2     4     1     5     8     3     7     3     6     3    15     1     4     2     2     1     2     1     1     1 
## 25000  <NA> 
##     1  2193

## [1] "Frequency table after encoding"
## eh_s9q69. Q403: Cart  Kariton
##             0           100           150           200           250           300           350           500           600          1000          1200          1500 
##             1             4             2             3             1             7             1             3             2             4             1             5 
##          2000          2500          3000          3500          4000          4500          5000          5500          6000          7000          8000          9000 
##             8             3             7             3             6             3            15             1             4             2             2             1 
##         10000         12000         13000         15000 20300 or more          <NA> 
##             2             1             1             1             1          2193

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q70)[na.exclude(mydata$eh_s9q70)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q70", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q70. Q404: Kerosene or propane stove  Kerosene o propane stove
## -998    0    5   10   45   50   55   60  100  150  200  250  280  300  350  400  450  500  520  525  550  565  600  650  700  750  800  850  900 1000 1100 1200 1300 
##   12    6    1    1    1    3    1    1   10    7   19    7    1   18    5    9    3   69    1    1    4    1   24    4   25    4   29    3   12   77    3   36    6 
## 1400 1500 1600 1700 1760 1800 1900 2000 2050 2100 2200 2250 2300 2400 2450 2500 2600 2700 2800 2900 3000 3100 3200 3400 3500 3600 3700 3800 3900 3950 4000 4200 4500 
##    7   75    5    5    1    7    1   47    1    5    6    2    6    1    1   25    4    4    8    1   26    1    4    1   14    2    3    1    1    1    8    1    3 
## 5000 5500 6000 6500 7000 7800 8000 <NA> 
##    8    1    1    1    1    1    1 1592

## [1] "Frequency table after encoding"
## eh_s9q70. Q404: Kerosene or propane stove  Kerosene o propane stove
##         -998            0            5           10           45           50           55           60          100          150          200          250 
##           12            6            1            1            1            3            1            1           10            7           19            7 
##          280          300          350          400          450          500          520          525          550          565          600          650 
##            1           18            5            9            3           69            1            1            4            1           24            4 
##          700          750          800          850          900         1000         1100         1200         1300         1400         1500         1600 
##           25            4           29            3           12           77            3           36            6            7           75            5 
##         1700         1760         1800         1900         2000         2050         2100         2200         2250         2300         2400         2450 
##            5            1            7            1           47            1            5            6            2            6            1            1 
##         2500         2600         2700         2800         2900         3000         3100         3200         3400         3500         3600         3700 
##           25            4            4            8            1           26            1            4            1           14            2            3 
##         3800         3900         3950         4000         4200         4500         5000         5500         6000 6262 or more         <NA> 
##            1            1            1            8            1            3            8            1            1            4         1592

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q71)[na.exclude(mydata$eh_s9q71)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q71", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q71. Q405: Stove with Oven/Gas Range  Stove na may oven/gas range
##  -998     0    30    65   100   150   200   300   390   400   450   500   530   550   555   600   625   650   680   700   730   750   790   800   850   900  1000  1100 
##     4     3     1     1     2     1     2     4     1     1     4    29     2     1     1     6     1     1     1    10     1     2     1    12     1     4    40     2 
##  1200  1280  1300  1350  1400  1500  1600  1700  1800  1860  2000  2100  2200  2250  2300  2400  2450  2500  2600  2700  2800  2900  3000  3200  3400  3500  3600  3900 
##    16     1     2     1     1    41     5     4     6     1    42     4     5     1     4     1     1    13     3     2     5     3    40     2     1    11     2     2 
##  4000  4100  5000  5500  5880  6000  7000  8500 10000 11000 15000 19000 19150 20000  <NA> 
##    13     1     7     1     1     1     2     1     1     1     1     1     1     1  1896

## [1] "Frequency table after encoding"
## eh_s9q71. Q405: Stove with Oven/Gas Range  Stove na may oven/gas range
##          -998             0            30            65           100           150           200           300           390           400           450           500 
##             4             3             1             1             2             1             2             4             1             1             4            29 
##           530           550           555           600           625           650           680           700           730           750           790           800 
##             2             1             1             6             1             1             1            10             1             2             1            12 
##           850           900          1000          1100          1200          1280          1300          1350          1400          1500          1600          1700 
##             1             4            40             2            16             1             2             1             1            41             5             4 
##          1800          1860          2000          2100          2200          2250          2300          2400          2450          2500          2600          2700 
##             6             1            42             4             5             1             4             1             1            13             3             2 
##          2800          2900          3000          3200          3400          3500          3600          3900          4000          4100          5000          5500 
##             5             3            40             2             1            11             2             2            13             1             7             1 
##          5880          6000          7000          8500         10000         11000         15000         19000 19006 or more          <NA> 
##             1             1             2             1             1             1             1             1             2          1896

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q72)[na.exclude(mydata$eh_s9q72)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q72", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q72. Q406: Refrigerator  Refrigerator
##  -999  -998    12   150   200   250   300   500   700   800   900  1000  1200  1500  2000  2200  2500  2800  3000  3500  4000  4500  5000  5500  6000  6100  6500  6800 
##     1     4     1     1     1     1     3    12     2     2     1    23     1     9    27     1     5     1    29     3    13     3    43     2    12     1     2     1 
##  7000  7500  8000  8500  9000  9300  9800 10000 10300 10500 11000 11500 11800 12000 12500 12800 12900 13000 14000 14500 14700 15000 16000 17000 17900 18000 19000 20000 
##    25     1    16     2     9     1     1    46     1     3     7     1     1    27     1     1     1     5    14     2     1    15     7     4     1    12     2     5 
## 22000 24000 25000 30000 34000 36000 37000  <NA> 
##     2     2     1     2     1     1     1  1861

## [1] "Frequency table after encoding"
## eh_s9q72. Q406: Refrigerator  Refrigerator
##          -999          -998            12           150           200           250           300           500           700           800           900          1000 
##             1             4             1             1             1             1             3            12             2             2             1            23 
##          1200          1500          2000          2200          2500          2800          3000          3500          4000          4500          5000          5500 
##             1             9            27             1             5             1            29             3            13             3            43             2 
##          6000          6100          6500          6800          7000          7500          8000          8500          9000          9300          9800         10000 
##            12             1             2             1            25             1            16             2             9             1             1            46 
##         10300         10500         11000         11500         11800         12000         12500         12800         12900         13000         14000         14500 
##             1             3             7             1             1            27             1             1             1             5            14             2 
##         14700         15000         16000         17000         17900         18000         19000         20000         22000         24000         25000         30000 
##             1            15             7             4             1            12             2             5             2             2             1             2 
## 33480 or more          <NA> 
##             3          1861

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q73)[na.exclude(mydata$eh_s9q73)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q73", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q73. Q407: Clothes Washing Machine  Washing Machine
##  -998     0    50   100   150   200   250   300   400   500   550   600   700   750   800   900  1000  1200  1500  1800  1900  2000  2015  2100  2200  2300  2400  2500 
##     3     2     1     2     1     3     2     4     1    25     1     3     4     2     6     1    49     2    40     3     1    68     1     1     4     6     6    48 
##  2600  2700  2750  2800  2900  3000  3100  3200  3300  3400  3500  3600  3650  3700  3800  3900  4000  4100  4200  4300  4500  4600  4700  4800  4900  5000  5100  5125 
##     8    12     1    20     5    73     3    11     3     1    38     2     1     2     8     1    27     1     3     2    19     2     1     1     2    50     2     1 
##  5200  5500  5700  5800  6000  6100  6300  6500  7000  7499  7500  7700  8000  8500  8700  9000  9800 10000 11000 12000 12500 13000 15000 20000  <NA> 
##     1    13     1     1    15     1     1     4    18     1     7     1    12     1     2     6     1     6     1     4     1     4     1     1  1594

## [1] "Frequency table after encoding"
## eh_s9q73. Q407: Clothes Washing Machine  Washing Machine
##          -998             0            50           100           150           200           250           300           400           500           550           600 
##             3             2             1             2             1             3             2             4             1            25             1             3 
##           700           750           800           900          1000          1200          1500          1800          1900          2000          2015          2100 
##             4             2             6             1            49             2            40             3             1            68             1             1 
##          2200          2300          2400          2500          2600          2700          2750          2800          2900          3000          3100          3200 
##             4             6             6            48             8            12             1            20             5            73             3            11 
##          3300          3400          3500          3600          3650          3700          3800          3900          4000          4100          4200          4300 
##             3             1            38             2             1             2             8             1            27             1             3             2 
##          4500          4600          4700          4800          4900          5000          5100          5125          5200          5500          5700          5800 
##            19             2             1             1             2            50             2             1             1            13             1             1 
##          6000          6100          6300          6500          7000          7499          7500          7700          8000          8500          8700          9000 
##            15             1             1             4            18             1             7             1            12             1             2             6 
##          9800         10000         11000         12000         12500 13000 or more          <NA> 
##             1             6             1             4             1             6          1594

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q74)[na.exclude(mydata$eh_s9q74)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q74", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q74. Q408: Air Conditioner  Air Con
##     0  1000  4000  5000  5300  6500  8000  9000 10000  <NA> 
##     1     1     2     1     1     1     2     1     2  2276

## [1] "Frequency table after encoding"
## eh_s9q74. Q408: Air Conditioner  Air Con
##             0          1000          4000          5000          5300          6500          8000          9000 10000 or more          <NA> 
##             1             1             2             1             1             1             2             1             2          2276

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q75)[na.exclude(mydata$eh_s9q75)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q75", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q75. Q409: Electric Fan  Electric Fan
##  -998     0    20    50    60    70    80    90    95   100   110   120   125   130   150   160   180   200   220   230   240   248   250   260   300   350   380   400 
##     8    12     1    19     1     1     1     1     1    37     1     2     1     1    36     2     4    70     1     1     2     1    21     1   104    15     1    48 
##   425   450   500   540   549   550   560   580   599   600   630   650   680   699   700   750   780   800   850   900   920   925   950   980   999  1000  1020  1025 
##     1     6   224     1     1     6     1     2     2   115     1    11     1     1   160    19     1    74     4    36     1     1     3     1     1   146     1     1 
##  1050  1100  1150  1175  1198  1200  1250  1300  1350  1355  1390  1400  1450  1500  1550  1580  1600  1650  1700  1750  1800  1900  1950  2000  2040  2050  2100  2150 
##     1    21     2     2     1    80     1    22     2     1     1    27     1   104     1     1    16     1    10     2    28     6     3    58     1     1     8     1 
##  2200  2239  2250  2300  2340  2400  2500  2700  2800  2870  2900  3000  3100  3150  3200  3300  3500  3600  3700  3800  3900  4000  4200  4500  5000  6000  6800  7000 
##    10     1     2     3     1    10    12     3     6     1     1    32     1     1     3     2    10     3     3     1     1     5     2     3     4     3     1     1 
##  7600  8000 12000 15003  <NA> 
##     1     1     1     1   539

## [1] "Frequency table after encoding"
## eh_s9q75. Q409: Electric Fan  Electric Fan
##         -998            0           20           50           60           70           80           90           95          100          110          120 
##            8           12            1           19            1            1            1            1            1           37            1            2 
##          125          130          150          160          180          200          220          230          240          248          250          260 
##            1            1           36            2            4           70            1            1            2            1           21            1 
##          300          350          380          400          425          450          500          540          549          550          560          580 
##          104           15            1           48            1            6          224            1            1            6            1            2 
##          599          600          630          650          680          699          700          750          780          800          850          900 
##            2          115            1           11            1            1          160           19            1           74            4           36 
##          920          925          950          980          999         1000         1020         1025         1050         1100         1150         1175 
##            1            1            3            1            1          146            1            1            1           21            2            2 
##         1198         1200         1250         1300         1350         1355         1390         1400         1450         1500         1550         1580 
##            1           80            1           22            2            1            1           27            1          104            1            1 
##         1600         1650         1700         1750         1800         1900         1950         2000         2040         2050         2100         2150 
##           16            1           10            2           28            6            3           58            1            1            8            1 
##         2200         2239         2250         2300         2340         2400         2500         2700         2800         2870         2900         3000 
##           10            1            2            3            1           10           12            3            6            1            1           32 
##         3100         3150         3200         3300         3500         3600         3700         3800         3900         4000         4200         4500 
##            1            1            3            2           10            3            3            1            1            5            2            3 
##         5000 5259 or more         <NA> 
##            4            9          539

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q76)[na.exclude(mydata$eh_s9q76)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q76", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q76. Q411: Pedicab  Pedicab
##     0   300   400   500  1000  1200  1500  2000  2500  3000  3200  4000  4500  5000  5400  6000  7000  8000  9000  9500 10000 12000 12600 13000 14000 18000 21000 25200 
##     1     1     1     3     8     1     4     5     3    12     1     3     2    17     1     1     6     4     1     1    12     2     1     1     1     1     1     1 
## 30000  <NA> 
##     1  2191

## [1] "Frequency table after encoding"
## eh_s9q76. Q411: Pedicab  Pedicab
##             0           300           400           500          1000          1200          1500          2000          2500          3000          3200          4000 
##             1             1             1             3             8             1             4             5             3            12             1             3 
##          4500          5000          5400          6000          7000          8000          9000          9500         10000         12000         12600         13000 
##             2            17             1             1             6             4             1             1            12             2             1             1 
##         14000         18000         21000         25200 27695 or more          <NA> 
##             1             1             1             1             1          2191

percentile_99.5 <- floor(quantile(na.exclude(mydata$eh_s9q77)[na.exclude(mydata$eh_s9q77)!=999999], probs = c(0.995)))
mydata <- top_recode (variable="eh_s9q77", break_point=percentile_99.5, missing=999999)
## [1] "Frequency table before encoding"
## eh_s9q77. Q412: Rice Stocks [Un-milled dry rice]   Palay
##     0    30   100   200   300   450   500   540   600   700   752   800   850   855   900  1000  1100  1200  1300  1350  1400  1500  1564  1600  1800  1850  1908  2000 
##     1     1     1     1     1     1     3     1     3     7     1     9     4     1     4    10     2     1     1     1     3    10     1     4     3     1     1    12 
##  2058  2070  2100  2200  2400  2500  2600  2660  2700  2958  3000  3200  3300  3400  3500  3600  3750  3825  3900  4000  4200  4230  4320  4400  4500  4700  4800  5000 
##     1     1     3     1     1     1     1     1     4     1    16     2     3     2     3     1     1     1     1     8     3     1     2     2     3     1     5    13 
##  5400  5600  5750  6000  6120  6300  6480  6960  7000  7200  7350  7400  7452  7500  7560  7680  8000  8100  8400  9000  9200  9600  9800  9960 10000 10080 10170 10500 
##     1     2     1     9     1     1     1     1     7     5     1     1     1     1     1     1     7     1     2     6     1     3     1     1     4     1     1     1 
## 11000 11730 12000 13000 13200 13500 14200 14250 14260 14300 15000 16000 18000 20000 21000 22496 22932 23760 24000 25000 36000 90000  <NA> 
##     1     1     6     1     2     2     1     1     1     1     1     1     1     1     1     1     1     1     1     1     1     1  2023

## [1] "Frequency table after encoding"
## eh_s9q77. Q412: Rice Stocks [Un-milled dry rice]   Palay
##             0            30           100           200           300           450           500           540           600           700           752           800 
##             1             1             1             1             1             1             3             1             3             7             1             9 
##           850           855           900          1000          1100          1200          1300          1350          1400          1500          1564          1600 
##             4             1             4            10             2             1             1             1             3            10             1             4 
##          1800          1850          1908          2000          2058          2070          2100          2200          2400          2500          2600          2660 
##             3             1             1            12             1             1             3             1             1             1             1             1 
##          2700          2958          3000          3200          3300          3400          3500          3600          3750          3825          3900          4000 
##             4             1            16             2             3             2             3             1             1             1             1             8 
##          4200          4230          4320          4400          4500          4700          4800          5000          5400          5600          5750          6000 
##             3             1             2             2             3             1             5            13             1             2             1             9 
##          6120          6300          6480          6960          7000          7200          7350          7400          7452          7500          7560          7680 
##             1             1             1             1             7             5             1             1             1             1             1             1 
##          8000          8100          8400          9000          9200          9600          9800          9960         10000         10080         10170         10500 
##             7             1             2             6             1             3             1             1             4             1             1             1 
##         11000         11730         12000         13000         13200         13500         14200         14250         14260         14300         15000         16000 
##             1             1             6             1             2             2             1             1             1             1             1             1 
##         18000         20000         21000         22496         22932         23760         24000         25000 32480 or more          <NA> 
##             1             1             1             1             1             1             1             1             2          2023

Indirect PII - Categorical: Recode, encode, or Top/bottom coding for extreme values

# !!!Include relevant variables in list below (Indirect PII - Categorical, and Ordinal if not processed yet)

indirect_PII <- c("eh_s9q1",
                  "eh_s9q4",
                  "eh_s9q5",
                  "eh_s9q6")

capture_tables (indirect_PII)

Matching and crosstabulations: Run automated PII check

# !!!Insufficient demographic data

Open-ends: review responses for any sensitive information, redact as necessary

# !!!No Open-ends

GPS data: Displace

# !!!No GPS data

Save processed data in Stata and SPSS format

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)