Identificación Política

Lapop17

library(rio)
encuesta=import("lapop17.dta")
names(encuesta)
##   [1] "pais"         "sobremuestra" "idnum"        "uniq_id"     
##   [5] "upm"          "prov"         "municipio"    "cluster"     
##   [9] "ur"           "tamano"       "idiomaq"      "fecha"       
##  [13] "wt"           "estratopri"   "estratosec"   "q2"          
##  [17] "q1"           "perprov"      "ls3"          "a4"          
##  [21] "soct2"        "idio2"        "np1"          "sgl1"        
##  [25] "cp6"          "cp7"          "cp8"          "cp13"        
##  [29] "cp20"         "it1"          "l1"           "prot3"       
##  [33] "jc10"         "jc13"         "jc15a"        "vic1ext"     
##  [37] "vic1exta"     "vic2new"      "aoj11"        "aoj12"       
##  [41] "b1"           "b2"           "b3"           "b4"          
##  [45] "b6"           "b43"          "b12"          "b13"         
##  [49] "b18"          "b21"          "b21a"         "b32"         
##  [53] "b37"          "b47a"         "m1"           "m2"          
##  [57] "sd2new2"      "sd3new2"      "sd6new2"      "infrax"      
##  [61] "infra3"       "ros1"         "ros4"         "ing4"        
##  [65] "eff1"         "eff2"         "aoj22new"     "media3"      
##  [69] "media4"       "exp_a"        "dst1b"        "drk1"        
##  [73] "env1c"        "env2b"        "envp3l"       "envp3l_o"    
##  [77] "envp3n"       "envp3n_o"     "envp41"       "envp42"      
##  [81] "pn4"          "w14a"         "e5"           "e15"         
##  [85] "e16"          "d1"           "d2"           "d3"          
##  [89] "d4"           "d5"           "d6"           "ivv3"        
##  [93] "lib1"         "lib2b"        "lib2c"        "lib4"        
##  [97] "exc2"         "exc6"         "exc20"        "exc11"       
## [101] "exc13"        "exc14"        "exc15"        "exc16"       
## [105] "exc18"        "exc7"         "exc7new"      "vb1"         
## [109] "vb2"          "vb3n"         "vb10"         "vb11"        
## [113] "pol1"         "vb20"         "dis7a"        "dis8a"       
## [117] "dis9a"        "dis10a"       "dis11a"       "for5"        
## [121] "mil10a"       "mil10e"       "ccq1"         "ccq2"        
## [125] "ccq3"         "ccq4"         "ie1"          "ie2"         
## [129] "ie3"          "ie6"          "ie9"          "ie10"        
## [133] "envp8"        "wf1"          "cct1b"        "ed"          
## [137] "ed2"          "q5a"          "q5b"          "q3c"         
## [141] "ocup4a"       "ocup1a"       "q10g"         "q10new"      
## [145] "q14"          "q10d"         "q10e"         "q11n"        
## [149] "q12c"         "q12bn"        "q12"          "q12m"        
## [153] "q12f"         "vac1"         "etid"         "iiet1"       
## [157] "iiet2"        "iiet3"        "www1"         "gi0"         
## [161] "pr1"          "r3"           "r4"           "r4a"         
## [165] "r5"           "r6"           "r7"           "r8"          
## [169] "r12"          "r14"          "r15"          "r18"         
## [173] "r1"           "r16"          "colorr"       "conocim"     
## [177] "iarea1"       "iarea2"       "iarea3"       "iarea4"      
## [181] "iarea6"       "iarea7"       "sexi"         "colori"      
## [185] "srvyrid"      "nationality"  "formatq"      "sex"
str(encuesta)
## 'data.frame':    2647 obs. of  188 variables:
##  $ pais        : num  11 11 11 11 11 11 11 11 11 11 ...
##   ..- attr(*, "label")= chr "Country"
##   ..- attr(*, "format.stata")= chr "%36.0g"
##   ..- attr(*, "labels")= Named num 11
##   .. ..- attr(*, "names")= chr "Peru"
##  $ sobremuestra: num  1 0 0 0 1 1 0 1 0 1 ...
##   ..- attr(*, "label")= chr "Sobremuestra"
##   ..- attr(*, "format.stata")= chr "%10.0g"
##  $ idnum       : num  1753 2596 229 1303 1989 ...
##   ..- attr(*, "label")= chr "Questionnaire Number"
##   ..- attr(*, "format.stata")= chr "%36.0g"
##  $ uniq_id     : num  16111753 16112596 16110229 16111303 16111989 ...
##   ..- attr(*, "label")= chr "Unique Identifier"
##   ..- attr(*, "format.stata")= chr "%36.0g"
##   ..- attr(*, "labels")= Named num  16110001 16110002 16110003 16110004 16110005 ...
##   .. ..- attr(*, "names")= chr  "PER16_0001" "PER16_0002" "PER16_0003" "PER16_0004" ...
##  $ upm         : num  241 97 97 103 232 205 102 206 97 232 ...
##   ..- attr(*, "label")= chr "Primary Sampling Unit"
##   ..- attr(*, "format.stata")= chr "%36.0g"
##  $ prov        : num  1122 1105 1105 1121 1116 ...
##   ..- attr(*, "label")= chr "Departament"
##   ..- attr(*, "format.stata")= chr "%36.0g"
##   ..- attr(*, "labels")= Named num  1101 1102 1103 1104 1105 ...
##   .. ..- attr(*, "names")= chr  "AMAZONAS" "ANCASH" "APURIMAC" "AREQUIPA" ...
##  $ municipio   : num  11221003 11050502 11050502 11210205 11160505 ...
##   ..- attr(*, "label")= chr "Municipio"
##   ..- attr(*, "format.stata")= chr "%36.0g"
##   ..- attr(*, "labels")= Named num  1.1e+07 1.1e+07 1.1e+07 1.1e+07 1.1e+07 ...
##   .. ..- attr(*, "names")= chr  "CAJARURO" "CUMBA" "HUARAZ" "JANGAS" ...
##  $ cluster     : num  467 223 224 236 430 483 234 321 223 431 ...
##   ..- attr(*, "label")= chr "Cluster"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##  $ ur          : num  2 2 2 2 2 2 2 2 2 2 ...
##   ..- attr(*, "label")= chr "Urban/Rural"
##   ..- attr(*, "format.stata")= chr "%36.0g"
##   ..- attr(*, "labels")= Named num  1 2
##   .. ..- attr(*, "names")= chr  "Urban" "Rural"
##  $ tamano      : num  5 5 5 5 5 5 5 5 5 5 ...
##   ..- attr(*, "label")= chr "Size of Location"
##   ..- attr(*, "format.stata")= chr "%37.0g"
##   ..- attr(*, "labels")= Named num  1 2 3 4 5
##   .. ..- attr(*, "names")= chr  "National Capital (Metropolitan area)" "Large City" "Medium City" "Small City" ...
##  $ idiomaq     : num  1 1 1 1 1 1 1 1 1 1 ...
##   ..- attr(*, "label")= chr "Language of Questionnaire"
##   ..- attr(*, "format.stata")= chr "%36.0g"
##   ..- attr(*, "labels")= Named num 1
##   .. ..- attr(*, "names")= chr "Spanish"
##  $ fecha       : Date, format: "2017-02-14" "2017-02-17" ...
##  $ wt          : num  0.303 1.431 1.431 1.431 0.303 ...
##   ..- attr(*, "label")= chr "Country Weight"
##   ..- attr(*, "format.stata")= chr "%36.0g"
##  $ estratopri  : num  1104 1107 1107 1107 1104 ...
##   ..- attr(*, "label")= chr "Primary Strata"
##   ..- attr(*, "format.stata")= chr "%36.0g"
##   ..- attr(*, "labels")= Named num  1101 1102 1103 1104 1105 ...
##   .. ..- attr(*, "names")= chr  "Costa Norte" "Costa Sur" "Lima Metropolitana" "Selva" ...
##  $ estratosec  : num  3 3 3 3 3 3 3 3 3 3 ...
##   ..- attr(*, "label")= chr "Secondary Strata"
##   ..- attr(*, "format.stata")= chr "%36.0g"
##   ..- attr(*, "labels")= Named num  1 2 3
##   .. ..- attr(*, "names")= chr  "Large (more than 100,000)" "Medium (between 25,000 and 100,000)" "Small (less than 25,000)"
##  $ q2          : num  39 52 56 68 59 45 52 19 34 32 ...
##   ..- attr(*, "label")= chr "Age"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##  $ q1          : num  1 2 1 1 1 2 1 1 2 1 ...
##   ..- attr(*, "label")= chr "Sex"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2
##   .. ..- attr(*, "names")= chr  "Male" "Female"
##  $ perprov     : num  2210 505 505 2102 1605 ...
##   ..- attr(*, "label")= chr "Province"
##   ..- attr(*, "format.stata")= chr "%36.0g"
##   ..- attr(*, "labels")= Named num  107 201 204 208 210 212 218 301 304 401 ...
##   .. ..- attr(*, "names")= chr  "UTCUBAMBA" "HUARAZ" "ASUNCIÓN" "CASMA" ...
##  $ ls3         : num  1 3 2 NA 1 2 4 2 2 2 ...
##   ..- attr(*, "label")= chr "Life Satisfaction"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 NA NA
##   .. ..- attr(*, "names")= chr  "Very Satisfied" "Somewhat Satisfied" "Somewhat Dissatisfied" "Very Dissatisfied" ...
##  $ a4          : num  25 1 1 NA 13 4 13 13 21 NA ...
##   ..- attr(*, "label")= chr "Most Important Problem"
##   ..- attr(*, "format.stata")= chr "%64.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 5 7 10 11 13 15 ...
##   .. ..- attr(*, "names")= chr  "Economy, problems with, crisis of" "Inflation, high prices" "Unemployment" "Poverty" ...
##  $ soct2       : num  3 3 3 2 2 2 3 2 3 NA ...
##   ..- attr(*, "label")= chr "Evaluation of the Economic Situation of the Country"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 NA NA
##   .. ..- attr(*, "names")= chr  "Better" "Same" "Worse" "Don't Know" ...
##  $ idio2       : num  3 3 3 2 3 3 3 2 3 2 ...
##   ..- attr(*, "label")= chr "Perception of Personal Economic Situation"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 NA NA
##   .. ..- attr(*, "names")= chr  "Better" "Same" "Worse" "Don't Know" ...
##  $ np1         : num  2 1 1 NA 2 2 2 2 2 2 ...
##   ..- attr(*, "label")= chr "Attendance at Municipal Meeting"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 NA NA
##   .. ..- attr(*, "names")= chr  "Yes" "No" "Don't Know" "No Response"
##  $ sgl1        : num  2 4 4 2 5 3 5 4 5 4 ...
##   ..- attr(*, "label")= chr "Quality of Municipal Services"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 5 NA NA
##   .. ..- attr(*, "names")= chr  "Very Good" "Good" "Neither Good nor Bad (Fair)" "Bad" ...
##  $ cp6         : num  4 3 3 1 3 4 2 3 1 3 ...
##   ..- attr(*, "label")= chr "Attendance at Meetings of Religious Organization"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 NA NA
##   .. ..- attr(*, "names")= chr  "Once a Week" "Once or Twice a Month" "Once or Twice a Year" "Never" ...
##  $ cp7         : num  3 2 2 4 4 3 4 4 1 2 ...
##   ..- attr(*, "label")= chr "Attendance at Meetings of Parent Association"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 NA NA
##   .. ..- attr(*, "names")= chr  "Once a Week" "Once or Twice a Month" "Once or Twice a Year" "Never" ...
##  $ cp8         : num  3 2 2 4 4 4 4 4 2 2 ...
##   ..- attr(*, "label")= chr "Attendance at Meetings of Community Improvement Group"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 NA NA
##   .. ..- attr(*, "names")= chr  "Once a Week" "Once or Twice a Month" "Once or Twice a Year" "Never" ...
##  $ cp13        : num  3 4 4 4 1 4 4 4 4 4 ...
##   ..- attr(*, "label")= chr "Attendance at Meetings of Political Movements or Parties"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 NA NA
##   .. ..- attr(*, "names")= chr  "Once a Week" "Once or Twice a Month" "Once or Twice a Year" "Never" ...
##  $ cp20        : num  NA 2 NA NA NA 1 NA NA 2 NA ...
##   ..- attr(*, "label")= chr "Attendance at Meetings of Women's Group"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 NA NA NA
##   .. ..- attr(*, "names")= chr  "Once a Week" "Once or Twice a Month" "Once or Twice a Year" "Never" ...
##  $ it1         : num  3 2 2 3 1 3 4 1 1 3 ...
##   ..- attr(*, "label")= chr "Interpersonal Trust"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 NA NA
##   .. ..- attr(*, "names")= chr  "Very Trustworthy" "Somewhat Trustworthy" "Not Very Trustworthy" "Untrustworthy" ...
##  $ l1          : num  10 NA NA 10 10 5 3 5 4 2 ...
##   ..- attr(*, "label")= chr "Ideology (Left / Right)"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 10 NA NA
##   .. ..- attr(*, "names")= chr  "Left" "Right" "Don't Know" "No Response"
##  $ prot3       : num  1 2 2 2 2 1 2 2 2 2 ...
##   ..- attr(*, "label")= chr "Participated in a Protest"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 NA
##   .. ..- attr(*, "names")= chr  "Yes, I have participated" "No, I have not participated" "Don't Know"
##  $ jc10        : num  NA 2 NA NA 1 1 NA 1 2 1 ...
##   ..- attr(*, "label")= chr "Coup is Justified when Crime is High"
##   ..- attr(*, "format.stata")= chr "%74.0f"
##   ..- attr(*, "labels")= Named num  1 2 NA NA NA
##   .. ..- attr(*, "names")= chr  "Yes, a military take-over of the state would be justified" "No, a military take-over of the state would not be justified" "Don't Know" "No Response" ...
##  $ jc13        : num  1 NA NA 2 NA NA 2 NA NA NA ...
##   ..- attr(*, "label")= chr "Coup is Justified when Corruption is High"
##   ..- attr(*, "format.stata")= chr "%74.0f"
##   ..- attr(*, "labels")= Named num  1 2 NA NA NA
##   .. ..- attr(*, "names")= chr  "Yes, a military take-over of the state would be justified" "No, a military take-over of the state would not be justified" "Don't Know" "No Response" ...
##  $ jc15a       : num  1 NA NA 2 2 1 2 2 2 2 ...
##   ..- attr(*, "label")= chr "JC15A. ¿Cree usted que cuando el país enfrenta momentos muy difíciles, se justif"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 NA NA
##   .. ..- attr(*, "names")= chr  "Yes, it is justified" "No, it is not justified" "Don't Know" "No Response"
##  $ vic1ext     : num  2 2 2 2 1 2 2 2 2 2 ...
##   ..- attr(*, "label")= chr "Victim of Crime in the Last 12 Months"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 NA NA
##   .. ..- attr(*, "names")= chr  "Yes" "No" "Don't Know" "No Response"
##  $ vic1exta    : num  NA NA NA NA 3 NA NA NA NA NA ...
##   ..- attr(*, "label")= chr "Victim of Crime in the Last 12 Months (Frequency)"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  NA NA NA
##   .. ..- attr(*, "names")= chr  "Don't Know" "No Response" "Not Applicable"
##  $ vic2new     : num  NA NA NA NA 8 NA NA NA NA NA ...
##   ..- attr(*, "label")= chr "Type of Victimization"
##   ..- attr(*, "format.stata")= chr "%75.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 5 6 7 8 9 10 ...
##   .. ..- attr(*, "names")= chr  "Unarmed robbery, no assault or physical threats" "Unarmed robbery with assault or physical threats" "Armed robbery" "Assault but not robbery" ...
##  $ aoj11       : num  1 3 3 NA 4 2 4 1 3 2 ...
##   ..- attr(*, "label")= chr "Perception of Neighborhood Insecurity"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 NA NA
##   .. ..- attr(*, "names")= chr  "Very Safe" "Somewhat Safe" "Somewhat Unsafe" "Very Unsafe" ...
##  $ aoj12       : num  1 4 4 4 1 4 2 2 1 4 ...
##   ..- attr(*, "label")= chr "Confidence that Judiciary will Punish the Guilty"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 NA NA
##   .. ..- attr(*, "names")= chr  "A lot" "Some" "Little" "None" ...
##  $ b1          : num  7 2 2 4 1 3 2 2 7 3 ...
##   ..- attr(*, "label")= chr "Courts Guarantee Fair Trial"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Not at All" "A Lot" "Don't Know" "No Response"
##  $ b2          : num  7 NA 3 5 7 5 2 4 7 5 ...
##   ..- attr(*, "label")= chr "Respect for Political Institutions"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Not at All" "A Lot" "Don't Know" "No Response"
##  $ b3          : num  7 3 2 3 1 6 1 2 7 2 ...
##   ..- attr(*, "label")= chr "Basic Rights are Protected"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Not at All" "A Lot" "Don't Know" "No Response"
##  $ b4          : num  5 2 NA 2 1 4 2 4 7 7 ...
##   ..- attr(*, "label")= chr "Pride in Political System"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Not at All" "A Lot" "Don't Know" "No Response"
##  $ b6          : num  NA 1 2 3 7 6 3 3 7 1 ...
##   ..- attr(*, "label")= chr "People Should Support the Political System"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Not at All" "A Lot" "Don't Know" "No Response"
##  $ b43         : num  6 7 7 6 7 7 5 7 7 7 ...
##   ..- attr(*, "label")= chr "Pride in Nationality"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Not at All" "A Lot" "Don't Know" "No Response"
##  $ b12         : num  7 1 2 7 5 5 3 4 7 7 ...
##   ..- attr(*, "label")= chr "Trust in Armed Forces"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Not at All" "A Lot" "Don't Know" "No Response"
##  $ b13         : num  1 2 2 1 1 3 2 2 7 6 ...
##   ..- attr(*, "label")= chr "Trust in the National Legislature"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Not at All" "A Lot" "Don't Know" "No Response"
##  $ b18         : num  2 1 2 1 7 6 1 1 7 2 ...
##   ..- attr(*, "label")= chr "Trust in National Police"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Not at All" "A Lot" "Don't Know" "No Response"
##  $ b21         : num  3 1 2 2 1 4 3 2 4 4 ...
##   ..- attr(*, "label")= chr "Trust in Political Parties"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Not at All" "A Lot" "Don't Know" "No Response"
##  $ b21a        : num  NA NA NA 6 1 6 3 4 3 5 ...
##   ..- attr(*, "label")= chr "Trust in Executive"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Not at All" "A Lot" "Don't Know" "No Response"
##  $ b32         : num  5 3 2 2 1 6 3 3 1 1 ...
##   ..- attr(*, "label")= chr "Trust in Local Government"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Not at All" "A Lot" "Don't Know" "No Response"
##  $ b37         : num  7 4 4 4 7 7 3 2 4 7 ...
##   ..- attr(*, "label")= chr "Trust in the Media"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Not at All" "A Lot" "Don't Know" "No Response"
##  $ b47a        : num  1 3 2 5 1 6 4 3 6 7 ...
##   ..- attr(*, "label")= chr "Trust in Elections"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Not at All" "A Lot" "Don't Know" "No Response"
##  $ m1          : num  5 3 3 4 5 3 5 3 NA 2 ...
##   ..- attr(*, "label")= chr "Presidential Job Approval"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 5 NA NA
##   .. ..- attr(*, "names")= chr  "Very Good" "Good" "Neither Good nor Bad (Fair)" "Bad" ...
##  $ m2          : num  3 NA 3 5 5 1 3 4 3 NA ...
##   ..- attr(*, "label")= chr "Congressional Job Approval"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 5 NA NA
##   .. ..- attr(*, "names")= chr  "Very Well" "Well" "Neither well nor poorly" "Poorly" ...
##  $ sd2new2     : num  4 3 3 2 4 3 3 3 2 2 ...
##   ..- attr(*, "label")= chr "Satisfaction with Roads"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 NA NA NA
##   .. ..- attr(*, "names")= chr  "Very Satisfied" "Satisfied" "Dissatisfied" "Very Dissatisfied" ...
##  $ sd3new2     : num  2 3 3 1 2 1 3 3 1 2 ...
##   ..- attr(*, "label")= chr "Satisfaction with Public Schools"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 NA NA NA
##   .. ..- attr(*, "names")= chr  "Very Satisfied" "Satisfied" "Dissatisfied" "Very Dissatisfied" ...
##  $ sd6new2     : num  2 3 3 1 2 4 3 3 1 2 ...
##   ..- attr(*, "label")= chr "Satisfaction with Public Medical and Health Services"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 NA NA NA
##   .. ..- attr(*, "names")= chr  "Very Satisfied" "Satisfied" "Dissatisfied" "Very Dissatisfied" ...
##  $ infrax      : num  4 6 6 5 2 1 2 6 4 6 ...
##   ..- attr(*, "label")= chr "Police Response Time"
##   ..- attr(*, "format.stata")= chr "%52.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 5 6 NA NA
##   .. ..- attr(*, "names")= chr  "Less than 10 minutes" "Between 10 and 30 minutes" "More than 30 minutes and up to an hour" "More than 1 hour and up to 3 hours" ...
##  $ infra3      : num  4 4 2 3 2 1 3 1 1 1 ...
##   ..- attr(*, "label")= chr "Time it Takes to Get to the Hospital"
##   ..- attr(*, "format.stata")= chr "%84.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 5 6 NA NA
##   .. ..- attr(*, "names")= chr  "Less than 10 minutes" "Between 10 and 30 minutes" "More than 30 minutes and up to an hour" "More than 1 hour and up to 3 hours" ...
##  $ ros1        : num  2 6 4 2 5 6 4 6 6 5 ...
##   ..- attr(*, "label")= chr "The State Should Own Important Industries"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Strongly Disagree" "Strongly Agree" "Don't Know" "No Response"
##  $ ros4        : num  2 6 4 4 7 7 3 7 5 7 ...
##   ..- attr(*, "label")= chr "Government Should Implement Policies to Reduce Income Inequality"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Strongly Disagree" "Strongly Agree" "Don't Know" "No Response"
##  $ ing4        : num  4 4 3 6 4 7 3 7 4 3 ...
##   ..- attr(*, "label")= chr "Democracy is Better than Any Other Form of Government"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Strongly Disagree" "Strongly Agree" "Don't Know" "No Response"
##  $ eff1        : num  1 3 3 4 3 7 4 2 3 5 ...
##   ..- attr(*, "label")= chr "Leaders Are Interested in What People Think"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Strongly Disagree" "Strongly Agree" "Don't Know" "No Response"
##  $ eff2        : num  2 1 2 3 6 5 4 2 2 2 ...
##   ..- attr(*, "label")= chr "Understands Important Political Issues"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Strongly Disagree" "Strongly Agree" "Don't Know" "No Response"
##  $ aoj22new    : num  7 7 7 5 7 7 5 5 7 7 ...
##   ..- attr(*, "label")= chr "Penalties for Crimes Need to Increase"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Strongly Disagree" "Strongly Agree" "Don't Know" "No Response"
##  $ media3      : num  2 5 4 6 4 7 3 3 4 6 ...
##   ..- attr(*, "label")= chr "News Media Represents the Different Views that Exist in the Country"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Strongly Disagree" "Strongly Agree" "Don't Know" "No Response"
##  $ media4      : num  3 3 3 4 2 4 4 6 2 5 ...
##   ..- attr(*, "label")= chr "News Media is Controlled by a Few Economic Groups"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Strongly Disagree" "Strongly Agree" "Don't Know" "No Response"
##  $ exp_a       : num  2 1 1 1 2 1 1 1 2 2 ...
##   ..- attr(*, "label")= chr "Experimental Test A"
##   ..- attr(*, "format.stata")= chr "%36.0g"
##   ..- attr(*, "labels")= Named num  1 2
##   .. ..- attr(*, "names")= chr  "Set 1" "Set 2"
##  $ dst1b       : num  1 4 4 4 7 7 3 4 7 7 ...
##   ..- attr(*, "label")= chr "Government Should Spend More to Enforce Building Codes to Make Homes Safe"
##   ..- attr(*, "format.stata")= chr "%36.0g"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Strongly Disagree" "Strongly Agree" "Don't Know" "No Response"
##  $ drk1        : num  3 4 4 2 4 4 4 4 3 4 ...
##   ..- attr(*, "label")= chr "Likelihood of Death or Harm from Natural Disaster"
##   ..- attr(*, "format.stata")= chr "%36.0g"
##   ..- attr(*, "labels")= Named num  1 2 3 4 NA NA
##   .. ..- attr(*, "names")= chr  "Not Likely at All" "A Little Likely" "Somewhat Likely" "Very Likely" ...
##  $ env1c       : num  2 1 1 2 5 1 4 2 7 3 ...
##   ..- attr(*, "label")= chr "Higher Priority for Protecting Environment or Promoting Economic Growth"
##   ..- attr(*, "format.stata")= chr "%36.0g"
##   ..- attr(*, "labels")= Named num  1 7 NA NA
##   .. ..- attr(*, "names")= chr  "Environment as priority" "Economic growth as priority" "Don't Know" "No Response"
##  $ env2b       : num  1 1 1 3 2 1 1 1 3 2 ...
##   ..- attr(*, "label")= chr "Seriousness of Climate Change"
##   ..- attr(*, "format.stata")= chr "%36.0g"
##   ..- attr(*, "labels")= Named num  1 2 3 4 NA NA
##   .. ..- attr(*, "names")= chr  "Very Serious" "Somewhat Serious" "Not So Serious" "Not Serious at All" ...
##  $ envp3l      : num  1 1 1 5 3 3 7 1 1 6 ...
##   ..- attr(*, "label")= chr "Most Serious Environmental Problem in Locality"
##   ..- attr(*, "format.stata")= chr "%73.0f"
##   ..- attr(*, "labels")= Named num  0 1 2 3 4 5 6 7 8 NA
##   .. ..- attr(*, "names")= chr  "None [Do not read] (there is no environmental problem in my area)" "Air pollution" "Pollution of rivers and seas" "Floods" ...
##  $ envp3l_o    : chr  "" "" "" "" ...
##   ..- attr(*, "label")= chr "Most Serious Environmental Problem in Locality (Other)"
##   ..- attr(*, "format.stata")= chr "%-37s"
##  $ envp3n      : num  5 1 1 1 3 2 1 4 1 NA ...
##   ..- attr(*, "label")= chr "Most Serious Environmental Problem in the Country"
##   ..- attr(*, "format.stata")= chr "%68.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 5 6 7 8 NA NA
##   .. ..- attr(*, "names")= chr  "Air pollution" "Pollution of rivers and seas" "Floods" "Flash flooding" ...
##  $ envp3n_o    : chr  "" "" "" "" ...
##   ..- attr(*, "label")= chr "Most Serious Environmental Problem in the Country (Other)"
##   ..- attr(*, "format.stata")= chr "%-37s"
##  $ envp41      : num  2 NA NA NA 2 5 NA 1 5 NA ...
##   ..- attr(*, "label")= chr "Responsible for Environmental Pollution"
##   ..- attr(*, "format.stata")= chr "%60.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 5 7 NA NA NA
##   .. ..- attr(*, "names")= chr  "People" "Extractive enterprises (mining, oil, gase, fishery)" "Other companies" "The State" ...
##  $ envp42      : num  NA 2 7 4 NA NA 5 NA NA 2 ...
##   ..- attr(*, "label")= chr "Responsible for Environmental Pollution"
##   ..- attr(*, "format.stata")= chr "%60.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 5 7 NA NA NA
##   .. ..- attr(*, "names")= chr  "People" "Extractive enterprises (mining, oil, gase, fishery)" "Other companies" "The State" ...
##  $ pn4         : num  4 3 2 1 3 4 3 3 4 2 ...
##   ..- attr(*, "label")= chr "Satisfaction with Democracy"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 4 NA NA
##   .. ..- attr(*, "names")= chr  "Very Satisfied" "Satisfied" "Dissatisfied" "Very Dissatisfied" ...
##  $ w14a        : num  1 1 1 2 2 1 2 2 2 NA ...
##   ..- attr(*, "label")= chr "Abortion Justified When Mother's Health is at Risk"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 NA NA
##   .. ..- attr(*, "names")= chr  "Yes, it is justified" "No, it is not justified" "Don't Know" "No Response"
##  $ e5          : num  2 5 2 6 4 10 5 6 6 4 ...
##   ..- attr(*, "label")= chr "Approval of Those Participating in Legal Demonstration"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 10 NA NA
##   .. ..- attr(*, "names")= chr  "Strongly disapprove" "Strongly approve" "Don't Know" "No Response"
##  $ e15         : num  10 2 2 6 2 7 5 2 1 1 ...
##   ..- attr(*, "label")= chr "Approval of Those Blocking Roads to Protest"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 10 NA NA
##   .. ..- attr(*, "names")= chr  "Strongly disapprove" "Strongly approve" "Don't Know" "No Response"
##  $ e16         : num  10 10 5 6 3 6 6 8 4 10 ...
##   ..- attr(*, "label")= chr "Approval of Vigilante Justice"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 10 NA NA
##   .. ..- attr(*, "names")= chr  "Strongly disapprove" "Strongly approve" "Don't Know" "No Response"
##  $ d1          : num  9 6 3 6 4 9 3 2 8 5 ...
##   ..- attr(*, "label")= chr "Approval of Government Critics' Right to Vote"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 10 NA NA
##   .. ..- attr(*, "names")= chr  "Strongly disapprove" "Strongly approve" "Don't Know" "No Response"
##  $ d2          : num  3 5 3 4 5 10 4 3 9 8 ...
##   ..- attr(*, "label")= chr "Approval of Government Critics' Right to Peaceful Demonstrations"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 10 NA NA
##   .. ..- attr(*, "names")= chr  "Strongly disapprove" "Strongly approve" "Don't Know" "No Response"
##  $ d3          : num  2 8 3 6 2 10 5 4 4 4 ...
##   ..- attr(*, "label")= chr "Approval of Government Critics' Right to Run for Office"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 10 NA NA
##   .. ..- attr(*, "names")= chr  "Strongly disapprove" "Strongly approve" "Don't Know" "No Response"
##  $ d4          : num  9 5 2 4 4 10 4 4 10 9 ...
##   ..- attr(*, "label")= chr "Approval of Government Critics' Right to Make Speeches"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 10 NA NA
##   .. ..- attr(*, "names")= chr  "Strongly disapprove" "Strongly approve" "Don't Know" "No Response"
##  $ d5          : num  1 NA NA 3 1 10 4 1 8 1 ...
##   ..- attr(*, "label")= chr "Approval of Homosexuals' Right to Run for Office"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 10 NA NA
##   .. ..- attr(*, "names")= chr  "Strongly disapprove" "Strongly approve" "Don't Know" "No Response"
##  $ d6          : num  2 1 NA 6 1 10 5 1 10 1 ...
##   ..- attr(*, "label")= chr "Approval of Same-Sex Couples' Right to Marry"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 10 NA NA
##   .. ..- attr(*, "names")= chr  "Strongly disapprove" "Strongly approve" "Don't Know" "No Response"
##  $ ivv3        : num  1 NA NA 8 1 1 3 1 4 1 ...
##   ..- attr(*, "label")= chr "Approve of Those Trying to Convince Voters to Nullify Ballots"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 10 NA NA
##   .. ..- attr(*, "names")= chr  "Strongly disapprove" "Strongly approve" "Don't Know" "No Response"
##  $ lib1        : num  3 1 1 1 1 1 1 3 1 1 ...
##   ..- attr(*, "label")= chr "Level of Freedom of the Press Today"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 NA NA
##   .. ..- attr(*, "names")= chr  "Very Little" "Enough" "Too Much" "Don't Know" ...
##  $ lib2b       : num  3 1 1 NA 1 1 1 1 1 3 ...
##   ..- attr(*, "label")= chr "Level of Freedom of Expression Today"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 NA NA
##   .. ..- attr(*, "names")= chr  "Very Little" "Enough" "Too Much" "Don't Know" ...
##  $ lib2c       : num  3 1 1 3 1 1 1 1 3 1 ...
##   ..- attr(*, "label")= chr "Level of Freedom to Express Political Opinions without Fear"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 NA NA
##   .. ..- attr(*, "names")= chr  "Very Little" "Enough" "Too Much" "Don't Know" ...
##  $ lib4        : num  3 1 1 3 1 1 1 1 2 1 ...
##   ..- attr(*, "label")= chr "Level of Protection of Human Rights Today"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  1 2 3 NA NA
##   .. ..- attr(*, "names")= chr  "Very Little" "Enough" "Too Much" "Don't Know" ...
##  $ exc2        : num  0 0 0 0 0 0 0 0 0 0 ...
##   ..- attr(*, "label")= chr "Police Officer Asked for a Bribe"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  0 1 NA NA
##   .. ..- attr(*, "names")= chr  "No" "Yes" "Don't Know" "No Response"
##  $ exc6        : num  1 0 0 0 0 0 0 0 0 0 ...
##   ..- attr(*, "label")= chr "Government Employee Asked for a Bribe"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  0 1 NA NA
##   .. ..- attr(*, "names")= chr  "No" "Yes" "Don't Know" "No Response"
##  $ exc20       : num  0 0 0 0 0 0 0 0 0 0 ...
##   ..- attr(*, "label")= chr "Soldier Requested a Bribe"
##   ..- attr(*, "format.stata")= chr "%36.0f"
##   ..- attr(*, "labels")= Named num  0 1 NA NA
##   .. ..- attr(*, "names")= chr  "No" "Yes" "Don't Know" "No Response"
##   [list output truncated]
##  - attr(*, "label")= chr "©AmericasBarometer, LAPOP; created 21 Sep 2017; type: notes list"
##  - attr(*, "notes")= chr  "For more information and details about the sample design, please consult the technical and country reports thro"| __truncated__ "4" "All data are de-identified and regulated by the Institutional Review Board (IRB) of Vanderbilt University. They"| __truncated__ "All data are copyrighted by the Latin American Public Opinion Project (LAPOP) and may only be used with the exp"| __truncated__ ...
str(encuesta$l1)
##  num [1:2647] 10 NA NA 10 10 5 3 5 4 2 ...
##  - attr(*, "label")= chr "Ideology (Left / Right)"
##  - attr(*, "format.stata")= chr "%36.0f"
##  - attr(*, "labels")= Named num [1:4] 1 10 NA NA
##   ..- attr(*, "names")= chr [1:4] "Left" "Right" "Don't Know" "No Response"
table(encuesta$l1)
## 
##   1   2   3   4   5   6   7   8   9  10 
## 199 162 249 244 582 261 169 238 103 263
library(questionr)
freqOrd=freq(encuesta$l1,cum = T)
freqOrd
##      n    % val%  %cum val%cum
## 1  199  7.5  8.1   7.5     8.1
## 2  162  6.1  6.6  13.6    14.6
## 3  249  9.4 10.1  23.0    24.7
## 4  244  9.2  9.9  32.3    34.6
## 5  582 22.0 23.6  54.3    58.1
## 6  261  9.9 10.6  64.1    68.7
## 7  169  6.4  6.8  70.5    75.5
## 8  238  9.0  9.6  79.5    85.2
## 9  103  3.9  4.2  83.4    89.4
## 10 263  9.9 10.6  93.3   100.0
## NA 177  6.7   NA 100.0      NA
freqOrd=data.frame(type=row.names(freqOrd),
                   freqOrd,
                   row.names = NULL)
freqOrd
##    type   n   X. val. X.cum val.cum
## 1     1 199  7.5  8.1   7.5     8.1
## 2     2 162  6.1  6.6  13.6    14.6
## 3     3 249  9.4 10.1  23.0    24.7
## 4     4 244  9.2  9.9  32.3    34.6
## 5     5 582 22.0 23.6  54.3    58.1
## 6     6 261  9.9 10.6  64.1    68.7
## 7     7 169  6.4  6.8  70.5    75.5
## 8     8 238  9.0  9.6  79.5    85.2
## 9     9 103  3.9  4.2  83.4    89.4
## 10   10 263  9.9 10.6  93.3   100.0
## 11   NA 177  6.7   NA 100.0      NA
library(ggplot2)
base = ggplot(data=freqOrd,aes(x=type,y=n)) 
base1= base + scale_x_discrete(limits=freqOrd$type)
bar1 = base1 + geom_bar(stat='identity') 
bar1

bar1 + labs(x="Tendencia Política", 
            y="Cantidad",
            title="¿Cómo se identifica en la escala Izquierda-Derecha?", 
            subtitle = "Año 2017",
            caption = "Fuente: LAPOP 2017")

library(qcc)
## Package 'qcc' version 2.7
## Type 'citation("qcc")' for citing this R package in publications.
pareto.chart(table(encuesta$l1),cumperc = c(0,50,80,100))

##     
## Pareto chart analysis for table(encuesta$l1)
##        Frequency   Cum.Freq.  Percentage Cum.Percent.
##   5   582.000000  582.000000   23.562753    23.562753
##   10  263.000000  845.000000   10.647773    34.210526
##   6   261.000000 1106.000000   10.566802    44.777328
##   3   249.000000 1355.000000   10.080972    54.858300
##   4   244.000000 1599.000000    9.878543    64.736842
##   8   238.000000 1837.000000    9.635628    74.372470
##   1   199.000000 2036.000000    8.056680    82.429150
##   7   169.000000 2205.000000    6.842105    89.271255
##   2   162.000000 2367.000000    6.558704    95.829960
##   9   103.000000 2470.000000    4.170040   100.000000
bar=ggplot(encuesta,aes(y=as.numeric(l1)))+ geom_boxplot() 
bar
## Warning: Removed 177 rows containing non-finite values (stat_boxplot).

bar + scale_y_discrete(limits = freqOrd$type)
## Warning: Removed 177 rows containing non-finite values (stat_boxplot).

Vemos que no hay valores atípicos

library(DescTools)
Mode(encuesta$l1)
## [1] 5

Vemos que la moda sería la posición 5 en la escala, lo que representaría el centro.

dataTable=table(encuesta$l1)
Herfindahl(dataTable)
## [1] 0.1244423

Podemos ver que la moda no es significativa y que varias categorías tienen pesos similares.

1/sum(prop.table(dataTable)**2)
## [1] 8.035853
Median(encuesta$l1,na.rm = T)
## [1] 5
IQR(encuesta$l1,na.rm = T)
## [1] 3
mad(as.numeric(encuesta$l1),na.rm = T)
## [1] 2.9652