Pepe Vignette

Seyma Kalay

library(pepe)

This package was set for the data visualization. First thing let’s see the str of the sample_data with str(sample_data).

Plot.by.Factr function will create plotting.

df <- sample_data[c("Formal","Informal","L.Both","No.Loan",
"sex","educ","political.afl","married",
 "havejob","rural","age","Income","Networth","Liquid.Assets",
 "NW.HE","fin.knowldge","fin.intermdiaries")]
 CN = colnames(df)
 var <- c("educ","rural","sex","havejob","political.afl")
 name.levels = c("Formal","Informal","L.Both","No.Loan",
 "sex","educ","political.afl","married",
 "havejob","rural","age","Income","Networth","Liquid.Assets",
 "NW.HE","fin.knowldge","fin.intermdiaries")

XXX <- df4.Plot.by.Factr(var,df)$Summ.Stats.long
Plot.by.Factr(XXX, name.levels)
#> Selecting by Mean
#> Joining, by = c("Variable", "Mean")
#> Warning: Transformation introduced infinite values in continuous x-axis
#> Transformation introduced infinite values in continuous x-axis
#> Selecting by Mean
#> Joining, by = c("Variable", "Mean")

#> Warning: Transformation introduced infinite values in continuous x-axis
#> Transformation introduced infinite values in continuous x-axis
#> Selecting by Mean
#> Joining, by = c("Variable", "Mean")

#> Warning: Transformation introduced infinite values in continuous x-axis
#> Transformation introduced infinite values in continuous x-axis
#> Selecting by Mean
#> Joining, by = c("Variable", "Mean")

#> Warning: Transformation introduced infinite values in continuous x-axis
#> Transformation introduced infinite values in continuous x-axis
#> Selecting by Mean
#> Joining, by = c("Variable", "Mean")

#> Warning: Transformation introduced infinite values in continuous x-axis
#> Transformation introduced infinite values in continuous x-axis

df4.Plot.by.Factr function will create group stats.

df4.Plot.by.Factr(var,df)
#> $Summ.Stats
#> $Summ.Stats[[1]]
#>                       educ_0      educ_1  educ_diff
#> age                   56.233      48.944      7.289
#> Income             50112.134  111281.618  61169.485
#> Networth          498209.669 1270342.194 772132.524
#> Liquid.Assets     542379.811 1343952.158 801572.347
#> NW.HE             482692.708 1187307.896 704615.189
#> Formal                 0.059       0.238      0.179
#> Informal               0.172       0.071      0.101
#> L.Both                 0.041       0.062      0.020
#> No.Loan                0.727       0.629      0.098
#> sex                    0.778       0.730      0.049
#> educ                   0.000       1.000      1.000
#> political.afl          0.122       0.341      0.219
#> married                0.859       0.861      0.002
#> havejob                0.627       0.671      0.044
#> rural                  0.562       0.879      0.317
#> fin.knowldge           0.019       0.129      0.110
#> fin.intermdiaries      0.179       0.196      0.017
#> 
#> $Summ.Stats[[2]]
#>                      rural_0     rural_1 rural_diff
#> age                   55.830      52.914      2.917
#> Income             41979.507   83801.586  41822.079
#> Networth          283621.530  980214.349 696592.819
#> Liquid.Assets     320888.314 1042114.177 721225.863
#> NW.HE             274315.470  928913.998 654598.528
#> Formal                 0.047       0.152      0.104
#> Informal               0.216       0.101      0.114
#> L.Both                 0.049       0.047      0.002
#> No.Loan                0.688       0.700      0.012
#> sex                    0.878       0.704      0.174
#> educ                   0.116       0.425      0.309
#> political.afl          0.125       0.226      0.100
#> married                0.886       0.847      0.039
#> havejob                0.773       0.574      0.198
#> rural                  0.000       1.000      1.000
#> fin.knowldge           0.017       0.074      0.057
#> fin.intermdiaries      0.195       0.180      0.015
#> 
#> $Summ.Stats[[3]]
#>                        sex_0      sex_1   sex_diff
#> age                   54.226     53.792      0.434
#> Income             69848.240  69695.249    152.991
#> Networth          856991.073 711293.342 145697.731
#> Liquid.Assets     913497.514 764005.787 149491.727
#> NW.HE             813350.902 676132.915 137217.987
#> Formal                 0.138      0.110      0.028
#> Informal               0.111      0.149      0.038
#> L.Both                 0.043      0.049      0.007
#> No.Loan                0.709      0.692      0.017
#> sex                    0.000      1.000      1.000
#> educ                   0.366      0.307      0.059
#> political.afl          0.159      0.202      0.043
#> married                0.691      0.913      0.222
#> havejob                0.438      0.704      0.266
#> rural                  0.828      0.613      0.215
#> fin.knowldge           0.067      0.050      0.017
#> fin.intermdiaries      0.176      0.187      0.011
#> 
#> $Summ.Stats[[4]]
#>                    havejob_0  havejob_1 havejob_diff
#> age                   63.576     48.475       15.101
#> Income             56781.006  76982.126    20201.120
#> Networth          757974.392 739081.250    18893.142
#> Liquid.Assets     805614.836 796037.507     9577.329
#> NW.HE             742160.748 689950.830    52209.918
#> Formal                 0.058      0.149        0.092
#> Informal               0.114      0.154        0.040
#> L.Both                 0.024      0.062        0.038
#> No.Loan                0.804      0.635        0.169
#> sex                    0.628      0.838        0.210
#> educ                   0.294      0.336        0.041
#> political.afl          0.219      0.177        0.042
#> married                0.784      0.903        0.119
#> havejob                0.000      1.000        1.000
#> rural                  0.787      0.595        0.192
#> fin.knowldge           0.046      0.059        0.013
#> fin.intermdiaries      0.195      0.179        0.017
#> 
#> $Summ.Stats[[5]]
#>                   political.afl_0 political.afl_1 political.afl_diff
#> age                        53.461          55.724              2.263
#> Income                  64184.651       93097.169          28912.518
#> Networth               661085.850     1102973.001         441887.150
#> Liquid.Assets          711676.724     1169314.401         457637.677
#> NW.HE                  630009.072     1040123.664         410114.592
#> Formal                      0.101           0.182              0.081
#> Informal                    0.154           0.081              0.073
#> L.Both                      0.047           0.051              0.004
#> No.Loan                     0.698           0.686              0.013
#> sex                         0.753           0.803              0.050
#> educ                        0.262           0.569              0.308
#> political.afl               0.000           1.000              1.000
#> married                     0.852           0.894              0.042
#> havejob                     0.653           0.591              0.063
#> rural                       0.636           0.780              0.145
#> fin.knowldge                0.040           0.116              0.076
#> fin.intermdiaries           0.188           0.171              0.017
#> 
#> 
#> $Summ.Stats.long
#> $Summ.Stats.long[[1]]
#>          Diff Levels        Mean          Variable
#> 1       7.289 educ_0      56.233               age
#> 2   61169.485 educ_0   50112.134            Income
#> 3  772132.524 educ_0  498209.669          Networth
#> 4  801572.347 educ_0  542379.811     Liquid.Assets
#> 5  704615.189 educ_0  482692.708             NW.HE
#> 6       0.179 educ_0       0.059            Formal
#> 7       0.101 educ_0       0.172          Informal
#> 8       0.020 educ_0       0.041            L.Both
#> 9       0.098 educ_0       0.727           No.Loan
#> 10      0.049 educ_0       0.778               sex
#> 11      1.000 educ_0       0.000              educ
#> 12      0.219 educ_0       0.122     political.afl
#> 13      0.002 educ_0       0.859           married
#> 14      0.044 educ_0       0.627           havejob
#> 15      0.317 educ_0       0.562             rural
#> 16      0.110 educ_0       0.019      fin.knowldge
#> 17      0.017 educ_0       0.179 fin.intermdiaries
#> 18      7.289 educ_1      48.944               age
#> 19  61169.485 educ_1  111281.618            Income
#> 20 772132.524 educ_1 1270342.194          Networth
#> 21 801572.347 educ_1 1343952.158     Liquid.Assets
#> 22 704615.189 educ_1 1187307.896             NW.HE
#> 23      0.179 educ_1       0.238            Formal
#> 24      0.101 educ_1       0.071          Informal
#> 25      0.020 educ_1       0.062            L.Both
#> 26      0.098 educ_1       0.629           No.Loan
#> 27      0.049 educ_1       0.730               sex
#> 28      1.000 educ_1       1.000              educ
#> 29      0.219 educ_1       0.341     political.afl
#> 30      0.002 educ_1       0.861           married
#> 31      0.044 educ_1       0.671           havejob
#> 32      0.317 educ_1       0.879             rural
#> 33      0.110 educ_1       0.129      fin.knowldge
#> 34      0.017 educ_1       0.196 fin.intermdiaries
#> 
#> $Summ.Stats.long[[2]]
#>          Diff  Levels        Mean          Variable
#> 1       2.917 rural_0      55.830               age
#> 2   41822.079 rural_0   41979.507            Income
#> 3  696592.819 rural_0  283621.530          Networth
#> 4  721225.863 rural_0  320888.314     Liquid.Assets
#> 5  654598.528 rural_0  274315.470             NW.HE
#> 6       0.104 rural_0       0.047            Formal
#> 7       0.114 rural_0       0.216          Informal
#> 8       0.002 rural_0       0.049            L.Both
#> 9       0.012 rural_0       0.688           No.Loan
#> 10      0.174 rural_0       0.878               sex
#> 11      0.309 rural_0       0.116              educ
#> 12      0.100 rural_0       0.125     political.afl
#> 13      0.039 rural_0       0.886           married
#> 14      0.198 rural_0       0.773           havejob
#> 15      1.000 rural_0       0.000             rural
#> 16      0.057 rural_0       0.017      fin.knowldge
#> 17      0.015 rural_0       0.195 fin.intermdiaries
#> 18      2.917 rural_1      52.914               age
#> 19  41822.079 rural_1   83801.586            Income
#> 20 696592.819 rural_1  980214.349          Networth
#> 21 721225.863 rural_1 1042114.177     Liquid.Assets
#> 22 654598.528 rural_1  928913.998             NW.HE
#> 23      0.104 rural_1       0.152            Formal
#> 24      0.114 rural_1       0.101          Informal
#> 25      0.002 rural_1       0.047            L.Both
#> 26      0.012 rural_1       0.700           No.Loan
#> 27      0.174 rural_1       0.704               sex
#> 28      0.309 rural_1       0.425              educ
#> 29      0.100 rural_1       0.226     political.afl
#> 30      0.039 rural_1       0.847           married
#> 31      0.198 rural_1       0.574           havejob
#> 32      1.000 rural_1       1.000             rural
#> 33      0.057 rural_1       0.074      fin.knowldge
#> 34      0.015 rural_1       0.180 fin.intermdiaries
#> 
#> $Summ.Stats.long[[3]]
#>          Diff Levels       Mean          Variable
#> 1       0.434  sex_0     54.226               age
#> 2     152.991  sex_0  69848.240            Income
#> 3  145697.731  sex_0 856991.073          Networth
#> 4  149491.727  sex_0 913497.514     Liquid.Assets
#> 5  137217.987  sex_0 813350.902             NW.HE
#> 6       0.028  sex_0      0.138            Formal
#> 7       0.038  sex_0      0.111          Informal
#> 8       0.007  sex_0      0.043            L.Both
#> 9       0.017  sex_0      0.709           No.Loan
#> 10      1.000  sex_0      0.000               sex
#> 11      0.059  sex_0      0.366              educ
#> 12      0.043  sex_0      0.159     political.afl
#> 13      0.222  sex_0      0.691           married
#> 14      0.266  sex_0      0.438           havejob
#> 15      0.215  sex_0      0.828             rural
#> 16      0.017  sex_0      0.067      fin.knowldge
#> 17      0.011  sex_0      0.176 fin.intermdiaries
#> 18      0.434  sex_1     53.792               age
#> 19    152.991  sex_1  69695.249            Income
#> 20 145697.731  sex_1 711293.342          Networth
#> 21 149491.727  sex_1 764005.787     Liquid.Assets
#> 22 137217.987  sex_1 676132.915             NW.HE
#> 23      0.028  sex_1      0.110            Formal
#> 24      0.038  sex_1      0.149          Informal
#> 25      0.007  sex_1      0.049            L.Both
#> 26      0.017  sex_1      0.692           No.Loan
#> 27      1.000  sex_1      1.000               sex
#> 28      0.059  sex_1      0.307              educ
#> 29      0.043  sex_1      0.202     political.afl
#> 30      0.222  sex_1      0.913           married
#> 31      0.266  sex_1      0.704           havejob
#> 32      0.215  sex_1      0.613             rural
#> 33      0.017  sex_1      0.050      fin.knowldge
#> 34      0.011  sex_1      0.187 fin.intermdiaries
#> 
#> $Summ.Stats.long[[4]]
#>         Diff    Levels       Mean          Variable
#> 1     15.101 havejob_0     63.576               age
#> 2  20201.120 havejob_0  56781.006            Income
#> 3  18893.142 havejob_0 757974.392          Networth
#> 4   9577.329 havejob_0 805614.836     Liquid.Assets
#> 5  52209.918 havejob_0 742160.748             NW.HE
#> 6      0.092 havejob_0      0.058            Formal
#> 7      0.040 havejob_0      0.114          Informal
#> 8      0.038 havejob_0      0.024            L.Both
#> 9      0.169 havejob_0      0.804           No.Loan
#> 10     0.210 havejob_0      0.628               sex
#> 11     0.041 havejob_0      0.294              educ
#> 12     0.042 havejob_0      0.219     political.afl
#> 13     0.119 havejob_0      0.784           married
#> 14     1.000 havejob_0      0.000           havejob
#> 15     0.192 havejob_0      0.787             rural
#> 16     0.013 havejob_0      0.046      fin.knowldge
#> 17     0.017 havejob_0      0.195 fin.intermdiaries
#> 18    15.101 havejob_1     48.475               age
#> 19 20201.120 havejob_1  76982.126            Income
#> 20 18893.142 havejob_1 739081.250          Networth
#> 21  9577.329 havejob_1 796037.507     Liquid.Assets
#> 22 52209.918 havejob_1 689950.830             NW.HE
#> 23     0.092 havejob_1      0.149            Formal
#> 24     0.040 havejob_1      0.154          Informal
#> 25     0.038 havejob_1      0.062            L.Both
#> 26     0.169 havejob_1      0.635           No.Loan
#> 27     0.210 havejob_1      0.838               sex
#> 28     0.041 havejob_1      0.336              educ
#> 29     0.042 havejob_1      0.177     political.afl
#> 30     0.119 havejob_1      0.903           married
#> 31     1.000 havejob_1      1.000           havejob
#> 32     0.192 havejob_1      0.595             rural
#> 33     0.013 havejob_1      0.059      fin.knowldge
#> 34     0.017 havejob_1      0.179 fin.intermdiaries
#> 
#> $Summ.Stats.long[[5]]
#>          Diff          Levels        Mean          Variable
#> 1       2.263 political.afl_0      53.461               age
#> 2   28912.518 political.afl_0   64184.651            Income
#> 3  441887.150 political.afl_0  661085.850          Networth
#> 4  457637.677 political.afl_0  711676.724     Liquid.Assets
#> 5  410114.592 political.afl_0  630009.072             NW.HE
#> 6       0.081 political.afl_0       0.101            Formal
#> 7       0.073 political.afl_0       0.154          Informal
#> 8       0.004 political.afl_0       0.047            L.Both
#> 9       0.013 political.afl_0       0.698           No.Loan
#> 10      0.050 political.afl_0       0.753               sex
#> 11      0.308 political.afl_0       0.262              educ
#> 12      1.000 political.afl_0       0.000     political.afl
#> 13      0.042 political.afl_0       0.852           married
#> 14      0.063 political.afl_0       0.653           havejob
#> 15      0.145 political.afl_0       0.636             rural
#> 16      0.076 political.afl_0       0.040      fin.knowldge
#> 17      0.017 political.afl_0       0.188 fin.intermdiaries
#> 18      2.263 political.afl_1      55.724               age
#> 19  28912.518 political.afl_1   93097.169            Income
#> 20 441887.150 political.afl_1 1102973.001          Networth
#> 21 457637.677 political.afl_1 1169314.401     Liquid.Assets
#> 22 410114.592 political.afl_1 1040123.664             NW.HE
#> 23      0.081 political.afl_1       0.182            Formal
#> 24      0.073 political.afl_1       0.081          Informal
#> 25      0.004 political.afl_1       0.051            L.Both
#> 26      0.013 political.afl_1       0.686           No.Loan
#> 27      0.050 political.afl_1       0.803               sex
#> 28      0.308 political.afl_1       0.569              educ
#> 29      1.000 political.afl_1       1.000     political.afl
#> 30      0.042 political.afl_1       0.894           married
#> 31      0.063 political.afl_1       0.591           havejob
#> 32      0.145 political.afl_1       0.780             rural
#> 33      0.076 political.afl_1       0.116      fin.knowldge
#> 34      0.017 political.afl_1       0.171 fin.intermdiaries

Stats.by.Factr function will create group stats.

 Stats.by.Factr(var, df)
#> $educ.0
#>                         mean         sd     n   median        min      max
#> Formal*                 1.06       0.24 22256      1.0        1.0        2
#> Informal*               1.17       0.38 22256      1.0        1.0        2
#> L.Both*                 1.04       0.20 22256      1.0        1.0        2
#> No.Loan*                1.73       0.45 22256      2.0        1.0        2
#> sex*                    1.78       0.42 22256      2.0        1.0        2
#> educ*                   1.00       0.00 22256      1.0        1.0        1
#> political.afl*          1.12       0.33 22256      1.0        1.0        2
#> married*                1.86       0.35 22256      2.0        1.0        2
#> havejob*                1.63       0.48 22256      2.0        1.0        2
#> rural*                  1.56       0.50 22256      2.0        1.0        2
#> age                    56.23      13.40 22256     57.0       17.0      101
#> Income              50112.13  127502.75 22256  31681.5  -800000.0  5000000
#> Networth           498209.67 1187345.68 22256 193778.0  -627904.2 19999748
#> Liquid.Assets      542379.81 1206224.03 22256 229982.1        0.0 20000000
#> NW.HE              482692.71 1143011.42 22256 189322.6 -1490700.0 19999748
#> fin.knowldge*           1.02       0.14 22256      1.0        1.0        2
#> fin.intermdiaries*      1.18       0.38 22256      1.0        1.0        2
#>                     skew kurtosis
#> Formal*             3.74    11.97
#> Informal*           1.74     1.02
#> L.Both*             4.60    19.21
#> No.Loan*           -1.02    -0.96
#> sex*               -1.34    -0.20
#> educ*                NaN      NaN
#> political.afl*      2.32     3.36
#> married*           -2.07     2.28
#> havejob*           -0.53    -1.72
#> rural*             -0.25    -1.94
#> age                 0.00    -0.43
#> Income             23.96   819.95
#> Networth            9.07   117.71
#> Liquid.Assets       8.97   115.38
#> NW.HE               8.93   116.05
#> fin.knowldge*       6.98    46.77
#> fin.intermdiaries*  1.67     0.80
#> 
#> $educ.1
#>                          mean         sd     n   median        min      max
#> Formal*                  1.24       0.43 10509      1.0        1.0        2
#> Informal*                1.07       0.26 10509      1.0        1.0        2
#> L.Both*                  1.06       0.24 10509      1.0        1.0        2
#> No.Loan*                 1.63       0.48 10509      2.0        1.0        2
#> sex*                     1.73       0.44 10509      2.0        1.0        2
#> educ*                    2.00       0.00 10509      2.0        2.0        2
#> political.afl*           1.34       0.47 10509      1.0        1.0        2
#> married*                 1.86       0.35 10509      2.0        1.0        2
#> havejob*                 1.67       0.47 10509      2.0        1.0        2
#> rural*                   1.88       0.33 10509      2.0        1.0        2
#> age                     48.94      14.82 10509     49.0       17.0       93
#> Income              111281.62  242540.61 10509  66840.0  -800000.0  5000000
#> Networth           1270342.19 2151333.30 10509 604400.0  -277925.9 19956044
#> Liquid.Assets      1343952.16 2190862.93 10509 669550.0        0.0 20000000
#> NW.HE              1187307.90 2040298.96 10509 558724.2 -3614776.0 19956044
#> fin.knowldge*            1.13       0.34 10509      1.0        1.0        2
#> fin.intermdiaries*       1.20       0.40 10509      1.0        1.0        2
#>                     skew kurtosis
#> Formal*             1.23    -0.49
#> Informal*           3.34     9.16
#> L.Both*             3.64    11.23
#> No.Loan*           -0.53    -1.71
#> sex*               -1.03    -0.93
#> educ*                NaN      NaN
#> political.afl*      0.67    -1.55
#> married*           -2.09     2.37
#> havejob*           -0.73    -1.47
#> rural*             -2.32     3.39
#> age                 0.27    -0.50
#> Income             11.91   197.81
#> Networth            4.65    28.89
#> Liquid.Assets       4.63    28.72
#> NW.HE               4.71    30.01
#> fin.knowldge*       2.21     2.90
#> fin.intermdiaries*  1.53     0.34
#> 
#> $rural.0
#>                         mean        sd     n   median        min      max  skew
#> Formal*                 1.05      0.21 11023      1.0        1.0        2  4.27
#> Informal*               1.22      0.41 11023      1.0        1.0        2  1.38
#> L.Both*                 1.05      0.22 11023      1.0        1.0        2  4.17
#> No.Loan*                1.69      0.46 11023      2.0        1.0        2 -0.81
#> sex*                    1.88      0.33 11023      2.0        1.0        2 -2.31
#> educ*                   1.12      0.32 11023      1.0        1.0        2  2.40
#> political.afl*          1.13      0.33 11023      1.0        1.0        2  2.26
#> married*                1.89      0.32 11023      2.0        1.0        2 -2.43
#> havejob*                1.77      0.42 11023      2.0        1.0        2 -1.30
#> rural*                  1.00      0.00 11023      1.0        1.0        1   NaN
#> age                    55.83     12.52 11023     55.0       17.0       99  0.05
#> Income              41979.51 113869.22 11023  23100.0  -800000.0  5000000 25.49
#> Networth           283621.53 765713.39 11023 117909.1  -315514.9 19842100 12.53
#> Liquid.Assets      320888.31 782991.65 11023 150426.4        0.0 20000000 12.32
#> NW.HE              274315.47 739872.21 11023 114235.3 -1136884.0 19842100 12.78
#> fin.knowldge*           1.02      0.13 11023      1.0        1.0        2  7.48
#> fin.intermdiaries*      1.19      0.40 11023      1.0        1.0        2  1.54
#>                    kurtosis
#> Formal*               16.20
#> Informal*             -0.09
#> L.Both*               15.39
#> No.Loan*              -1.34
#> sex*                   3.36
#> educ*                  3.78
#> political.afl*         3.13
#> married*               3.90
#> havejob*              -0.31
#> rural*                  NaN
#> age                   -0.33
#> Income              1015.45
#> Networth             224.93
#> Liquid.Assets        218.09
#> NW.HE                237.81
#> fin.knowldge*         53.95
#> fin.intermdiaries*     0.38
#> 
#> $rural.1
#>                          mean         sd     n   median        min      max
#> Formal*                  1.15       0.36 21742      1.0        1.0        2
#> Informal*                1.10       0.30 21742      1.0        1.0        2
#> L.Both*                  1.05       0.21 21742      1.0        1.0        2
#> No.Loan*                 1.70       0.46 21742      2.0        1.0        2
#> sex*                     1.70       0.46 21742      2.0        1.0        2
#> educ*                    1.42       0.49 21742      1.0        1.0        2
#> political.afl*           1.23       0.42 21742      1.0        1.0        2
#> married*                 1.85       0.36 21742      2.0        1.0        2
#> havejob*                 1.57       0.49 21742      2.0        1.0        2
#> rural*                   2.00       0.00 21742      2.0        2.0        2
#> age                     52.91      15.01 21742     52.0       17.0      101
#> Income               83801.59  197838.45 21742  51028.0  -800000.0  5000000
#> Networth            980214.35 1848058.17 21742 437612.4  -627904.2 19999748
#> Liquid.Assets      1042114.18 1880008.03 21742 494240.0        0.0 20000000
#> NW.HE               928914.00 1758036.37 21742 413127.2 -3614776.0 19999748
#> fin.knowldge*            1.07       0.26 21742      1.0        1.0        2
#> fin.intermdiaries*       1.18       0.38 21742      1.0        1.0        2
#>                     skew kurtosis
#> Formal*             1.94     1.77
#> Informal*           2.65     5.00
#> L.Both*             4.26    16.18
#> No.Loan*           -0.87    -1.24
#> sex*               -0.89    -1.20
#> educ*               0.30    -1.91
#> political.afl*      1.31    -0.28
#> married*           -1.93     1.71
#> havejob*           -0.30    -1.91
#> rural*               NaN      NaN
#> age                 0.07    -0.62
#> Income             14.90   308.53
#> Networth            5.64    43.48
#> Liquid.Assets       5.61    43.02
#> NW.HE               5.66    44.32
#> fin.knowldge*       3.27     8.68
#> fin.intermdiaries*  1.67     0.79
#> 
#> $sex.0
#>                         mean         sd    n   median        min      max  skew
#> Formal*                 1.14       0.34 7774      1.0        1.0        2  2.10
#> Informal*               1.11       0.31 7774      1.0        1.0        2  2.48
#> L.Both*                 1.04       0.20 7774      1.0        1.0        2  4.51
#> No.Loan*                1.71       0.45 7774      2.0        1.0        2 -0.92
#> sex*                    1.00       0.00 7774      1.0        1.0        1   NaN
#> educ*                   1.37       0.48 7774      1.0        1.0        2  0.56
#> political.afl*          1.16       0.37 7774      1.0        1.0        2  1.86
#> married*                1.69       0.46 7774      2.0        1.0        2 -0.83
#> havejob*                1.44       0.50 7774      1.0        1.0        2  0.25
#> rural*                  1.83       0.38 7774      2.0        1.0        2 -1.73
#> age                    54.23      15.82 7774     54.0       17.0      101 -0.02
#> Income              69848.24  162853.21 7774  41200.0  -497000.0  5000000 15.92
#> Networth           856991.07 1709612.37 7774 343647.5  -224187.3 19968200  5.79
#> Liquid.Assets      913497.51 1744638.87 7774 392846.6        0.0 20000000  5.78
#> NW.HE              813350.90 1616830.46 7774 323163.8 -1294996.0 19968200  5.69
#> fin.knowldge*           1.07       0.25 7774      1.0        1.0        2  3.45
#> fin.intermdiaries*      1.18       0.38 7774      1.0        1.0        2  1.70
#>                    kurtosis
#> Formal*                2.41
#> Informal*              4.16
#> L.Both*               18.31
#> No.Loan*              -1.16
#> sex*                    NaN
#> educ*                 -1.69
#> political.afl*         1.47
#> married*              -1.32
#> havejob*              -1.94
#> rural*                 1.00
#> age                   -0.71
#> Income               385.60
#> Networth              47.07
#> Liquid.Assets         46.88
#> NW.HE                 46.02
#> fin.knowldge*          9.90
#> fin.intermdiaries*     0.90
#> 
#> $sex.1
#>                         mean         sd     n   median        min      max
#> Formal*                 1.11       0.31 24991      1.0        1.0        2
#> Informal*               1.15       0.36 24991      1.0        1.0        2
#> L.Both*                 1.05       0.22 24991      1.0        1.0        2
#> No.Loan*                1.69       0.46 24991      2.0        1.0        2
#> sex*                    2.00       0.00 24991      2.0        2.0        2
#> educ*                   1.31       0.46 24991      1.0        1.0        2
#> political.afl*          1.20       0.40 24991      1.0        1.0        2
#> married*                1.91       0.28 24991      2.0        1.0        2
#> havejob*                1.70       0.46 24991      2.0        1.0        2
#> rural*                  1.61       0.49 24991      2.0        1.0        2
#> age                    53.79      13.77 24991     53.0       17.0       98
#> Income              69695.25  178977.35 24991  41906.0  -800000.0  5000000
#> Networth           711293.34 1567726.43 24991 268824.5  -627904.2 19999748
#> Liquid.Assets      764005.79 1595467.69 24991 311500.0        0.0 20000000
#> NW.HE              676132.91 1496042.85 24991 256900.0 -3614776.0 19999748
#> fin.knowldge*           1.05       0.22 24991      1.0        1.0        2
#> fin.intermdiaries*      1.19       0.39 24991      1.0        1.0        2
#>                     skew kurtosis
#> Formal*             2.49     4.22
#> Informal*           1.97     1.90
#> L.Both*             4.15    15.25
#> No.Loan*           -0.83    -1.31
#> sex*                 NaN      NaN
#> educ*               0.84    -1.30
#> political.afl*      1.48     0.20
#> married*           -2.92     6.54
#> havejob*           -0.90    -1.20
#> rural*             -0.46    -1.79
#> age                 0.03    -0.45
#> Income             16.84   396.16
#> Networth            6.77    62.97
#> Liquid.Assets       6.71    61.89
#> NW.HE               6.85    65.14
#> fin.knowldge*       4.11    14.85
#> fin.intermdiaries*  1.60     0.57
#> 
#> $havejob.0
#>                         mean         sd     n   median        min      max
#> Formal*                 1.06       0.23 11760      1.0        1.0        2
#> Informal*               1.11       0.32 11760      1.0        1.0        2
#> L.Both*                 1.02       0.15 11760      1.0        1.0        2
#> No.Loan*                1.80       0.40 11760      2.0        1.0        2
#> sex*                    1.63       0.48 11760      2.0        1.0        2
#> educ*                   1.29       0.46 11760      1.0        1.0        2
#> political.afl*          1.22       0.41 11760      1.0        1.0        2
#> married*                1.78       0.41 11760      2.0        1.0        2
#> havejob*                1.00       0.00 11760      1.0        1.0        1
#> rural*                  1.79       0.41 11760      2.0        1.0        2
#> age                    63.58      13.10 11760     65.0       17.0      101
#> Income              56781.01  155653.05 11760  36600.0  -800000.0  5000000
#> Networth           757974.39 1474245.30 11760 306132.7  -627904.2 19951804
#> Liquid.Assets      805614.84 1495360.94 11760 351125.2        0.0 20000000
#> NW.HE              742160.75 1432865.69 11760 300375.0 -1017962.0 19951804
#> fin.knowldge*           1.05       0.21 11760      1.0        1.0        2
#> fin.intermdiaries*      1.20       0.40 11760      1.0        1.0        2
#>                     skew kurtosis
#> Formal*             3.79    12.35
#> Informal*           2.43     3.88
#> L.Both*             6.28    37.47
#> No.Loan*           -1.53     0.36
#> sex*               -0.53    -1.72
#> educ*               0.90    -1.18
#> political.afl*      1.36    -0.15
#> married*           -1.38    -0.10
#> havejob*             NaN      NaN
#> rural*             -1.40    -0.04
#> age                -0.67     0.63
#> Income             21.44   598.68
#> Networth            6.11    56.40
#> Liquid.Assets       6.10    56.30
#> NW.HE               5.91    52.93
#> fin.knowldge*       4.32    16.66
#> fin.intermdiaries*  1.54     0.36
#> 
#> $havejob.1
#>                         mean         sd     n   median        min      max
#> Formal*                 1.15       0.36 21005      1.0        1.0        2
#> Informal*               1.15       0.36 21005      1.0        1.0        2
#> L.Both*                 1.06       0.24 21005      1.0        1.0        2
#> No.Loan*                1.64       0.48 21005      2.0        1.0        2
#> sex*                    1.84       0.37 21005      2.0        1.0        2
#> educ*                   1.34       0.47 21005      1.0        1.0        2
#> political.afl*          1.18       0.38 21005      1.0        1.0        2
#> married*                1.90       0.30 21005      2.0        1.0        2
#> havejob*                2.00       0.00 21005      2.0        2.0        2
#> rural*                  1.59       0.49 21005      2.0        1.0        2
#> age                    48.48      11.84 21005     49.0       17.0       96
#> Income              76982.13  184976.46 21005  44543.0  -800000.0  5000000
#> Networth           739081.25 1671801.15 21005 271012.9  -464159.8 19999748
#> Liquid.Assets      796037.51 1705697.57 21005 316000.0        0.0 20000000
#> NW.HE              689950.83 1576458.39 21005 256354.0 -3614776.0 19999748
#> fin.knowldge*           1.06       0.24 21005      1.0        1.0        2
#> fin.intermdiaries*      1.18       0.38 21005      1.0        1.0        2
#>                     skew kurtosis
#> Formal*             1.97     1.87
#> Informal*           1.92     1.68
#> L.Both*             3.65    11.30
#> No.Loan*           -0.56    -1.69
#> sex*               -1.83     1.36
#> educ*               0.70    -1.52
#> political.afl*      1.69     0.87
#> married*           -2.72     5.40
#> havejob*             NaN      NaN
#> rural*             -0.39    -1.85
#> age                 0.06    -0.34
#> Income             14.98   330.37
#> Networth            6.61    57.96
#> Liquid.Assets       6.53    56.79
#> NW.HE               6.77    61.61
#> fin.knowldge*       3.74    11.97
#> fin.intermdiaries*  1.68     0.82
#> 
#> $political.afl.0
#>                         mean         sd     n   median        min      max
#> Formal*                 1.10       0.30 26479      1.0        1.0        2
#> Informal*               1.15       0.36 26479      1.0        1.0        2
#> L.Both*                 1.05       0.21 26479      1.0        1.0        2
#> No.Loan*                1.70       0.46 26479      2.0        1.0        2
#> sex*                    1.75       0.43 26479      2.0        1.0        2
#> educ*                   1.26       0.44 26479      1.0        1.0        2
#> political.afl*          1.00       0.00 26479      1.0        1.0        1
#> married*                1.85       0.36 26479      2.0        1.0        2
#> havejob*                1.65       0.48 26479      2.0        1.0        2
#> rural*                  1.64       0.48 26479      2.0        1.0        2
#> age                    53.46      14.07 26479     53.0       17.0      101
#> Income              64184.65  171285.19 26479  37550.0  -800000.0  5000000
#> Networth           661085.85 1499929.43 26479 246738.6  -627904.2 19999748
#> Liquid.Assets      711676.72 1526257.28 26479 289848.1        0.0 20000000
#> NW.HE              630009.07 1427490.00 26479 236061.6 -2814200.0 19999748
#> fin.knowldge*           1.04       0.20 26479      1.0        1.0        2
#> fin.intermdiaries*      1.19       0.39 26479      1.0        1.0        2
#>                     skew kurtosis
#> Formal*             2.65     5.02
#> Informal*           1.92     1.69
#> L.Both*             4.27    16.25
#> No.Loan*           -0.86    -1.25
#> sex*               -1.17    -0.62
#> educ*               1.08    -0.82
#> political.afl*       NaN      NaN
#> married*           -1.98     1.93
#> havejob*           -0.64    -1.59
#> rural*             -0.56    -1.68
#> age                 0.02    -0.46
#> Income             17.88   441.53
#> Networth            7.20    71.35
#> Liquid.Assets       7.12    70.04
#> NW.HE               7.20    72.41
#> fin.knowldge*       4.70    20.11
#> fin.intermdiaries*  1.60     0.55
#> 
#> $political.afl.1
#>                          mean         sd    n   median        min      max
#> Formal*                  1.18       0.39 6286      1.0        1.0        2
#> Informal*                1.08       0.27 6286      1.0        1.0        2
#> L.Both*                  1.05       0.22 6286      1.0        1.0        2
#> No.Loan*                 1.69       0.46 6286      2.0        1.0        2
#> sex*                     1.80       0.40 6286      2.0        1.0        2
#> educ*                    1.57       0.50 6286      2.0        1.0        2
#> political.afl*           2.00       0.00 6286      2.0        2.0        2
#> married*                 1.89       0.31 6286      2.0        1.0        2
#> havejob*                 1.59       0.49 6286      2.0        1.0        2
#> rural*                   1.78       0.41 6286      2.0        1.0        2
#> age                     55.72      15.01 6286     56.0       17.0       98
#> Income               93097.17  189449.94 6286  61000.0  -800000.0  5000000
#> Networth           1102973.00 1941971.68 6286 497431.8  -329697.9 19918815
#> Liquid.Assets      1169314.40 1980845.88 6286 554688.7        0.0 20000000
#> NW.HE              1040123.66 1851839.13 6286 469564.3 -3614776.0 19918815
#> fin.knowldge*            1.12       0.32 6286      1.0        1.0        2
#> fin.intermdiaries*       1.17       0.38 6286      1.0        1.0        2
#>                     skew kurtosis
#> Formal*             1.65     0.71
#> Informal*           3.07     7.43
#> L.Both*             4.07    14.57
#> No.Loan*           -0.80    -1.36
#> sex*               -1.52     0.32
#> educ*              -0.28    -1.92
#> political.afl*       NaN      NaN
#> married*           -2.57     4.58
#> havejob*           -0.37    -1.86
#> rural*             -1.35    -0.16
#> age                -0.02    -0.69
#> Income             13.23   272.15
#> Networth            4.89    32.87
#> Liquid.Assets       4.89    32.95
#> NW.HE               4.95    34.14
#> fin.knowldge*       2.40     3.74
#> fin.intermdiaries*  1.75     1.07

Pvot.by.Factr function will create a percentage tables.

df <- sample_data[c("multi.level",
"Formal","L.Both","No.Loan",
 "region", "sex", "educ", "political.afl",
 "married", "havejob", "rural",
 "fin.knowldge", "fin.intermdiaries")]
 Pvot.by.Factr(df)
#>                        0      1      3      2
#> multi.level       69.59% 30.41%    NA%    NA%
#> Formal            88.35% 11.65%    NA%    NA%
#> L.Both            95.21%  4.79%    NA%    NA%
#> No.Loan           30.41% 69.59%    NA%    NA%
#> region               NA% 48.26% 24.48% 27.26%
#> sex               23.73% 76.27%    NA%    NA%
#> educ              67.93% 32.07%    NA%    NA%
#> political.afl     80.81% 19.19%    NA%    NA%
#> married           13.99% 86.01%    NA%    NA%
#> havejob           35.89% 64.11%    NA%    NA%
#> rural             33.64% 66.36%    NA%    NA%
#> fin.knowldge      94.55%  5.45%    NA%    NA%
#> fin.intermdiaries 81.54% 18.46%    NA%    NA%