Download the data (right-click and save)

http://antoinejardin.github.io/site/ess6.csv

loading data (European Social Survey V6)

ess6 <- read.csv("~/ess6.csv")

Looking at the first lines of the dataset

head(ess6)
##   cntry     cname cedition   cproddat cseqno      name essround edition
## 1    FR ESS1-6e01        1 26.11.2014 121083 ESS6e02_1        6     2.1
## 2    FR ESS1-6e01        1 26.11.2014 121084 ESS6e02_1        6     2.1
## 3    FR ESS1-6e01        1 26.11.2014 121085 ESS6e02_1        6     2.1
## 4    FR ESS1-6e01        1 26.11.2014 121086 ESS6e02_1        6     2.1
## 5    FR ESS1-6e01        1 26.11.2014 121087 ESS6e02_1        6     2.1
## 6    FR ESS1-6e01        1 26.11.2014 121088 ESS6e02_1        6     2.1
##   idno  dweight   pspwght  pweight tvtot tvpol rdtot rdpol nwsptot nwsppol
## 1    4 1.098133 0.8150754 2.702678     4     2    NA    NA      NA      NA
## 2    6 2.196265 2.0014163 2.702678     4     4    NA    NA      NA      NA
## 3   10 1.098133 1.0007081 2.702678     1     1    NA    NA      NA      NA
## 4   12 2.196265 1.6518854 2.702678     2     3    NA    NA      NA      NA
## 5   13 1.098133 0.6248008 2.702678     2     0    NA    NA      NA      NA
## 6   14 4.000000 2.9689506 2.702678     2     2    NA    NA      NA      NA
##   netuse ppltrst pplfair pplhlp polintr polcmpl poldcs trstprl trstlgl
## 1     NA       5       4      7       2      NA     NA       3       2
## 2     NA       4       7      4       2      NA     NA       4       5
## 3     NA       5      88      0       4      NA     NA       3       3
## 4     NA       5       4      0       2      NA     NA       6       2
## 5     NA       5      10     10       4      NA     NA       5      10
## 6     NA       7       5      5       3      NA     NA       6       8
##   trstplc trstplt trstprt trstep trstun vote contplt wrkprty wrkorg badge
## 1       5       3       4      7      5    2       2       2      2     2
## 2       8       3       3      5      5    1       2       2      2     2
## 3       5       0       0      0      0    1       2       2      2     2
## 4       5       4       2      2      2    1       2       1      1     2
## 5      10      10      10     10     10    3       2       2      2     2
## 6       8       5       5      3      3    1       1       2      2     2
##   sgnptit pbldmn bctprd clsprty prtdgcl mmbprty lrscale stflife stfeco
## 1       1      2      1       2       6      NA       5       3      2
## 2       2      2      1       1       2      NA       8       7      3
## 3       2      2      2       1       4      NA       9       2      2
## 4       2      2      1       1       1      NA      10       9      2
## 5       2      2      2       1       6      NA      77       8     10
## 6       1      2      2       1       2      NA       5       5      5
##   stfgov stfdem stfedu stfhlth gincdif freehms prtyban scnsenv euftf
## 1      3      4      6       1       1       1      NA      NA    10
## 2      5      7      7       8       1       1      NA      NA    10
## 3      2      2      5       3       1       1      NA      NA     0
## 4      2      3      5       5       2       1      NA      NA     6
## 5     10     10      5      10       1       1      NA      NA     5
## 6      3      5      7       8       1       1      NA      NA    10
##   imsmetn imdfetn impcntr imbgeco imueclt imwbcnt happy sclmeet inmdisc
## 1       2       2       4       5       0       0     7       6      NA
## 2       2       2       4       5       4       8     8       7      NA
## 3       4       4       4       1       2       0     8       7      NA
## 4       4       4       3       5       2       2     8       6      NA
## 5       8       8       1      10      10      10     7       7      NA
## 6       2       4       4       6       6       8     8       7      NA
##   sclact crmvct aesfdrk brghmwr brghmef crvctwr crvctef trrenyr trrcnyr
## 1      3      2       1      NA      NA      NA      NA      NA      NA
## 2      3      2       3      NA      NA      NA      NA      NA      NA
## 3      2      2       3      NA      NA      NA      NA      NA      NA
## 4      4      2       1      NA      NA      NA      NA      NA      NA
## 5      1      2       1      NA      NA      NA      NA      NA      NA
## 6      3      2       1      NA      NA      NA      NA      NA      NA
##   trrprsn trrtort health hlthhmp rlgblg rlgdnm rlgblge rlgdnme rlgdgr
## 1      NA      NA      3       3      2     66       1       1      8
## 2      NA      NA      1       3      1      1       6      66      6
## 3      NA      NA      3       2      2     66       1       1     10
## 4      NA      NA      2       3      2     66       1       1      0
## 5      NA      NA      2       2      1     77       6      66     10
## 6      NA      NA      1       3      1      6       6      66      5
##   rlgatnd pray dscrgrp dscrrce dscrntn dscrrlg dscrlng dscretn dscrage
## 1       7    6       2       0       0       0       0       0       0
## 2       7    7       2       0       0       0       0       0       0
## 3       5    7       2       0       0       0       0       0       0
## 4       7    7       2       0       0       0       0       0       0
## 5       4    2       2       0       0       0       0       0       0
## 6       7    7       2       0       0       0       0       0       0
##   dscrgnd dscrsex dscrdsb dscroth dscrdk dscrref dscrnap dscrna ctzcntr
## 1       0       0       0       0      0       0       1      0       1
## 2       0       0       0       0      0       0       1      0       1
## 3       0       0       0       0      0       0       1      0       1
## 4       0       0       0       0      0       0       1      0       1
## 5       0       0       0       0      0       0       1      0       1
## 6       0       0       0       0      0       0       1      0       1
##   ctzship ctzshipa ctzshipb ctzshipc brncntr cntbrth cntbrtha cntbrthb
## 1      NA       NA       NA       66       1      NA       NA       NA
## 2      NA       NA       NA       66       1      NA       NA       NA
## 3      NA       NA       NA       66       1      NA       NA       NA
## 4      NA       NA       NA       66       1      NA       NA       NA
## 5      NA       NA       NA       66       1      NA       NA       NA
## 6      NA       NA       NA       66       2      NA       NA       NA
##   cntbrthc livecntr livecnta lnghoma lnghom1 lnghomb lnghom2 blgetmg
## 1       66       NA     6666      NA     FRE      NA     000       2
## 2       66       NA     6666      NA     FRE      NA     000       2
## 3       66       NA     6666      NA     FRE      NA     000       2
## 4       66       NA     6666      NA     FRE      NA     000       2
## 5       66       NA     6666      NA     FRE      NA     000       8
## 6       XK       NA     1999      NA     FRE      NA     000       8
##   facntr facntn fbrncnt fbrncnta fbrncntb mocntr mocntn mbrncnt mbrncnta
## 1      1     NA      NA       NA       66      1     NA      NA       NA
## 2      1     NA      NA       NA       66      1     NA      NA       NA
## 3      1     NA      NA       NA       66      1     NA      NA       NA
## 4      1     NA      NA       NA       66      1     NA      NA       NA
## 5      2     NA      NA       NA       DZ      8     NA      NA       NA
## 6      2     NA      NA       NA       XK      2     NA      NA       NA
##   mbrncntb gndr partner rshpsts marsts marital martlfr maritala maritalb
## 1       66    1       2      66      4      NA      NA       NA        4
## 2       66    2       1       1     66      NA      NA       NA        1
## 3       66    2       2      66      5      NA      NA       NA        5
## 4       66    1       1       1     66      NA      NA       NA        1
## 5       66    2       2      66      6      NA      NA       NA        6
## 6       XK    1       1       1     66      NA      NA       NA        1
##   lvghw lvghwa lvgoptn lvgptn lvgptna lvgptne lvgptnea dvrcdev dvrcdeva
## 1    NA     NA      NA     NA      NA      NA        1      NA        1
## 2    NA     NA      NA     NA      NA      NA        2      NA        2
## 3    NA     NA      NA     NA      NA      NA        1      NA        2
## 4    NA     NA      NA     NA      NA      NA        2      NA        2
## 5    NA     NA      NA     NA      NA      NA        1      NA        2
## 6    NA     NA      NA     NA      NA      NA        2      NA        2
##   chldhm chldhhe domicil edulvla edulvlb eisced edufld eduyrs pdwrk edctn
## 1      2       1       5       3     321      3     NA     15     1     0
## 2      2       1       3       3     321      3     NA     14     0     0
## 3      2       1       3       3     321      3     NA      9     0     0
## 4      2       1       3       4     413      5     NA     10     0     0
## 5      2       1       3       3     321      3     NA     11     0     0
## 6      1       6       3       3     313      4     NA     12     1     0
##   uempla uempli dsbld rtrd cmsrv hswrk dngoth dngdk dngref dngna mainact
## 1      0      0     0    0     0     0      0     0      0     0      66
## 2      0      0     0    1     0     0      0     0      0     0      66
## 3      0      0     0    1     0     0      0     0      0     0      66
## 4      0      0     0    1     0     0      0     0      0     0      66
## 5      0      0     1    0     0     0      0     0      0     0      66
## 6      0      0     0    0     0     0      0     0      0     0      66
##   mnactic crpdwk pdjobev pdjobyr emplrel emplno wrkctr wrkctra estsz jbspv
## 1       1      6       6    6666       2      0     NA       6     1     2
## 2       6      2       1    2004       1  66666     NA       1     4     1
## 3       6      2       1    2002       3  66666     NA       3     1     2
## 4       6      2       1    1993       1  66666     NA       1     4     1
## 5       5      2       1    2006       1  66666     NA       1     1     2
## 6       1      6       6    6666       1  66666     NA       1     5     2
##   njbspv wkdcorg wkdcorga iorgact wkhct wkhtot nacer1 nacer11 nacer2
## 1  66666      NA       10      10    45     50     NA      NA      1
## 2      3      NA        5       0    35     40     NA      NA     86
## 3  66666      NA        0       0   888     50     NA      NA     45
## 4    120      NA        7       7    39     45     NA      NA     84
## 5  66666      NA        5       0    30     30     NA      NA     47
## 6  66666      NA        0       0    35     37     NA      NA     28
##   tporgwk iscoco isco08 wrkac6m uemp3m uemp12m uemp5yr mbtru hincsrc
## 1       5     NA   6330       2      2       6       6     3       2
## 2       2     NA   5321       2      2       6       6     3       3
## 3       5     NA   3313       2      2       6       6     3       3
## 4       1     NA   4120       2      2       6       6     3       3
## 5       4     NA   5223       2      1       1       1     2       5
## 6       4     NA   7212       2      2       6       6     3       1
##   hincsrca hinctnt hinctnta hincfel brwmny edulvlpa edulvlpb eiscedp
## 1        3      NA        2       2     NA       66     6666      66
## 2        4      NA        7       1     NA        5      520       5
## 3        4      NA        3       2     NA       66     6666      66
## 4        4      NA        7       2     NA        2      213       2
## 5        6      NA        1       2     NA       66     6666      66
## 6        1      NA        7       2     NA        1      113       1
##   pdwrkp edctnp uemplap uemplip dsbldp rtrdp cmsrvp hswrkp dngothp dngdkp
## 1      0      0       0       0      0     0      0      0       0      0
## 2      0      0       0       0      0     1      0      0       0      0
## 3      0      0       0       0      0     0      0      0       0      0
## 4      0      0       0       0      0     1      0      0       0      0
## 5      0      0       0       0      0     0      0      0       0      0
## 6      0      0       0       1      0     0      0      0       0      0
##   dngnapp dngrefp dngnap mnactp crpdwkp iscocop isco08p emprelp emplnop
## 1       1       0      0     66       6      NA   66666       6      NA
## 2       0       0      0     66       2      NA   66666       6      NA
## 3       1       0      0     66       6      NA   66666       6      NA
## 4       0       0      0     66       2      NA   66666       6      NA
## 5       1       0      0     66       6      NA   66666       6      NA
## 6       0       0      0     66       2      NA   66666       6      NA
##   jbspvp njbspvp wkdcorp ioactp wkhtotp edulvlfa edulvlfb eiscedf emprf14
## 1     NA      NA      NA     NA     666        1      113       1       2
## 2     NA      NA      NA     NA     666        1      113       1       1
## 3     NA      NA      NA     NA     666        1        0       1       1
## 4     NA      NA      NA     NA     666        1      113       1       1
## 5     NA      NA      NA     NA     666       77     7777      77       7
## 6     NA      NA      NA     NA     666        1        0       1       2
##   emplnof jbspvf occf14 occf14a occf14b edulvlma edulvlmb eiscedm emprm14
## 1      NA     NA     NA      NA       9        3      321       3       2
## 2      NA     NA     NA      NA       5        2      213       2       1
## 3      NA     NA     NA      NA       8        1        0       1       1
## 4      NA     NA     NA      NA       3        1      113       1       1
## 5      NA     NA     NA      NA      66       77     7777      77       7
## 6      NA     NA     NA      NA       9        1        0       1       3
##   emplnom jbspvm occm14 occm14a occm14b atncrse fxltph mbltph inttph  X
## 1      NA     NA     NA      NA       9       1     NA     NA     NA NA
## 2      NA     NA     NA      NA       3       2     NA     NA     NA NA
## 3      NA     NA     NA      NA      77       2     NA     NA     NA NA
## 4      NA     NA     NA      NA       4       2     NA     NA     NA NA
## 5      NA     NA     NA      NA      66       2     NA     NA     NA NA
## 6      NA     NA     NA      NA      66       2     NA     NA     NA NA

Display T1

t1
##    
##       0   1   2   3   4   5   6   7   8   9  10  77  88
##   1  55  27  71  75  80 229  63  83  80  23  49  21  25
##   2  66  25  67 120  94 288  77  98 104  32  50  23  43
ftable(t1)
##      0   1   2   3   4   5   6   7   8   9  10  77  88
##                                                       
## 1   55  27  71  75  80 229  63  83  80  23  49  21  25
## 2   66  25  67 120  94 288  77  98 104  32  50  23  43

Computing row and column percentages

prop.table(t1, 1)
##    
##              0          1          2          3          4          5
##   1 0.06242906 0.03064699 0.08059024 0.08513053 0.09080590 0.25993190
##   2 0.06071757 0.02299908 0.06163753 0.11039558 0.08647654 0.26494940
##    
##              6          7          8          9         10         77
##   1 0.07150965 0.09421112 0.09080590 0.02610670 0.05561862 0.02383655
##   2 0.07083717 0.09015639 0.09567617 0.02943882 0.04599816 0.02115915
##    
##             88
##   1 0.02837684
##   2 0.03955842
prop.table(t1, 2)
##    
##             0         1         2         3         4         5         6
##   1 0.4545455 0.5192308 0.5144928 0.3846154 0.4597701 0.4429400 0.4500000
##   2 0.5454545 0.4807692 0.4855072 0.6153846 0.5402299 0.5570600 0.5500000
##    
##             7         8         9        10        77        88
##   1 0.4585635 0.4347826 0.4181818 0.4949495 0.4772727 0.3676471
##   2 0.5414365 0.5652174 0.5818182 0.5050505 0.5227273 0.6323529

Storing results

t2 <- prop.table(t1, 2)

Looking at both tables

t1
##    
##       0   1   2   3   4   5   6   7   8   9  10  77  88
##   1  55  27  71  75  80 229  63  83  80  23  49  21  25
##   2  66  25  67 120  94 288  77  98 104  32  50  23  43
t2
##    
##             0         1         2         3         4         5         6
##   1 0.4545455 0.5192308 0.5144928 0.3846154 0.4597701 0.4429400 0.4500000
##   2 0.5454545 0.4807692 0.4855072 0.6153846 0.5402299 0.5570600 0.5500000
##    
##             7         8         9        10        77        88
##   1 0.4585635 0.4347826 0.4181818 0.4949495 0.4772727 0.3676471
##   2 0.5414365 0.5652174 0.5818182 0.5050505 0.5227273 0.6323529

Loading doBy

library(doBy)
## Loading required package: survival

Here we’re changing value labels

recodeVar(ess6$gndr, src=c(1,2), tgt=c("Male", "Female"))
##    [1] "Male"   "Female" "Female" "Male"   "Female" "Male"   "Male"  
##    [8] "Female" "Female" "Male"   "Male"   "Male"   "Male"   "Female"
##   [15] "Male"   "Female" "Female" "Male"   "Female" "Female" "Male"  
##   [22] "Male"   "Male"   "Male"   "Female" "Male"   "Male"   "Female"
##   [29] "Female" "Female" "Male"   "Male"   "Female" "Male"   "Male"  
##   [36] "Female" "Male"   "Female" "Female" "Male"   "Female" "Female"
##   [43] "Female" "Female" "Male"   "Female" "Male"   "Male"   "Female"
##   [50] "Male"   "Female" "Female" "Female" "Female" "Male"   "Male"  
##   [57] "Male"   "Male"   "Male"   "Male"   "Male"   "Female" "Female"
##   [64] "Male"   "Female" "Male"   "Female" "Male"   "Female" "Female"
##   [71] "Female" "Female" "Female" "Female" "Male"   "Female" "Male"  
##   [78] "Male"   "Female" "Male"   "Male"   "Female" "Male"   "Male"  
##   [85] "Female" "Female" "Female" "Male"   "Female" "Female" "Male"  
##   [92] "Female" "Female" "Female" "Male"   "Female" "Female" "Male"  
##   [99] "Female" "Male"   "Female" "Male"   "Female" "Female" "Female"
##  [106] "Female" "Male"   "Female" "Female" "Female" "Male"   "Male"  
##  [113] "Male"   "Female" "Male"   "Female" "Female" "Female" "Female"
##  [120] "Male"   "Male"   "Male"   "Male"   "Female" "Female" "Male"  
##  [127] "Male"   "Male"   "Male"   "Female" "Female" "Female" "Male"  
##  [134] "Female" "Female" "Female" "Female" "Female" "Female" "Female"
##  [141] "Female" "Female" "Female" "Male"   "Female" "Male"   "Female"
##  [148] "Male"   "Female" "Female" "Female" "Male"   "Female" "Female"
##  [155] "Female" "Female" "Male"   "Female" "Male"   "Female" "Female"
##  [162] "Male"   "Male"   "Female" "Female" "Male"   "Female" "Male"  
##  [169] "Male"   "Male"   "Female" "Female" "Female" "Male"   "Male"  
##  [176] "Female" "Female" "Female" "Female" "Male"   "Male"   "Female"
##  [183] "Male"   "Male"   "Female" "Male"   "Male"   "Male"   "Female"
##  [190] "Female" "Female" "Female" "Female" "Male"   "Female" "Female"
##  [197] "Female" "Female" "Female" "Female" "Male"   "Female" "Male"  
##  [204] "Male"   "Female" "Female" "Male"   "Male"   "Male"   "Male"  
##  [211] "Male"   "Male"   "Female" "Female" "Female" "Female" "Female"
##  [218] "Female" "Female" "Female" "Male"   "Female" "Female" "Female"
##  [225] "Female" "Female" "Female" "Male"   "Female" "Female" "Female"
##  [232] "Female" "Male"   "Male"   "Male"   "Male"   "Male"   "Female"
##  [239] "Male"   "Female" "Male"   "Female" "Female" "Male"   "Female"
##  [246] "Male"   "Female" "Male"   "Male"   "Female" "Male"   "Female"
##  [253] "Male"   "Female" "Male"   "Female" "Male"   "Male"   "Male"  
##  [260] "Female" "Male"   "Female" "Female" "Female" "Female" "Female"
##  [267] "Male"   "Male"   "Male"   "Female" "Male"   "Male"   "Female"
##  [274] "Male"   "Female" "Female" "Male"   "Female" "Female" "Female"
##  [281] "Male"   "Female" "Male"   "Male"   "Female" "Male"   "Male"  
##  [288] "Female" "Male"   "Male"   "Male"   "Male"   "Male"   "Female"
##  [295] "Male"   "Male"   "Male"   "Male"   "Male"   "Female" "Female"
##  [302] "Female" "Male"   "Female" "Male"   "Female" "Male"   "Male"  
##  [309] "Female" "Female" "Male"   "Male"   "Female" "Male"   "Female"
##  [316] "Female" "Female" "Female" "Female" "Female" "Male"   "Female"
##  [323] "Female" "Female" "Female" "Male"   "Female" "Female" "Female"
##  [330] "Male"   "Male"   "Female" "Male"   "Male"   "Male"   "Male"  
##  [337] "Male"   "Female" "Female" "Female" "Female" "Male"   "Female"
##  [344] "Female" "Female" "Male"   "Female" "Female" "Female" "Male"  
##  [351] "Male"   "Female" "Male"   "Female" "Male"   "Female" "Female"
##  [358] "Male"   "Female" "Female" "Male"   "Female" "Female" "Female"
##  [365] "Male"   "Male"   "Female" "Male"   "Female" "Female" "Female"
##  [372] "Female" "Female" "Male"   "Female" "Male"   "Female" "Female"
##  [379] "Female" "Female" "Male"   "Female" "Female" "Female" "Female"
##  [386] "Male"   "Male"   "Male"   "Female" "Male"   "Female" "Male"  
##  [393] "Female" "Female" "Male"   "Female" "Female" "Female" "Male"  
##  [400] "Female" "Male"   "Male"   "Male"   "Male"   "Male"   "Female"
##  [407] "Female" "Male"   "Female" "Male"   "Male"   "Female" "Female"
##  [414] "Male"   "Male"   "Female" "Female" "Female" "Female" "Male"  
##  [421] "Female" "Female" "Male"   "Female" "Male"   "Female" "Female"
##  [428] "Female" "Male"   "Male"   "Female" "Female" "Female" "Female"
##  [435] "Female" "Female" "Female" "Female" "Male"   "Male"   "Female"
##  [442] "Male"   "Male"   "Male"   "Male"   "Female" "Female" "Female"
##  [449] "Female" "Female" "Female" "Male"   "Male"   "Male"   "Male"  
##  [456] "Female" "Male"   "Female" "Male"   "Female" "Male"   "Female"
##  [463] "Male"   "Female" "Male"   "Male"   "Male"   "Female" "Female"
##  [470] "Female" "Male"   "Male"   "Male"   "Female" "Male"   "Male"  
##  [477] "Female" "Male"   "Male"   "Female" "Female" "Female" "Female"
##  [484] "Female" "Male"   "Male"   "Male"   "Female" "Male"   "Female"
##  [491] "Female" "Female" "Male"   "Male"   "Female" "Male"   "Male"  
##  [498] "Male"   "Female" "Female" "Male"   "Female" "Male"   "Female"
##  [505] "Male"   "Female" "Male"   "Male"   "Male"   "Female" "Male"  
##  [512] "Female" "Male"   "Male"   "Female" "Male"   "Male"   "Male"  
##  [519] "Male"   "Male"   "Female" "Male"   "Male"   "Female" "Male"  
##  [526] "Male"   "Female" "Male"   "Female" "Female" "Male"   "Male"  
##  [533] "Female" "Female" "Female" "Female" "Male"   "Male"   "Female"
##  [540] "Female" "Female" "Female" "Female" "Female" "Male"   "Female"
##  [547] "Female" "Male"   "Male"   "Male"   "Male"   "Female" "Female"
##  [554] "Female" "Female" "Male"   "Male"   "Female" "Female" "Female"
##  [561] "Male"   "Female" "Female" "Female" "Female" "Female" "Male"  
##  [568] "Female" "Male"   "Female" "Female" "Male"   "Female" "Male"  
##  [575] "Male"   "Female" "Female" "Male"   "Female" "Female" "Female"
##  [582] "Male"   "Female" "Female" "Male"   "Female" "Female" "Female"
##  [589] "Female" "Female" "Male"   "Female" "Female" "Female" "Male"  
##  [596] "Female" "Male"   "Male"   "Female" "Female" "Male"   "Male"  
##  [603] "Male"   "Female" "Female" "Male"   "Female" "Male"   "Female"
##  [610] "Female" "Female" "Male"   "Female" "Female" "Female" "Female"
##  [617] "Female" "Male"   "Male"   "Female" "Male"   "Female" "Female"
##  [624] "Female" "Male"   "Female" "Female" "Male"   "Male"   "Female"
##  [631] "Female" "Female" "Female" "Female" "Male"   "Female" "Male"  
##  [638] "Female" "Female" "Female" "Female" "Male"   "Female" "Female"
##  [645] "Female" "Female" "Male"   "Female" "Male"   "Female" "Female"
##  [652] "Male"   "Male"   "Female" "Male"   "Female" "Female" "Male"  
##  [659] "Male"   "Male"   "Male"   "Male"   "Male"   "Male"   "Female"
##  [666] "Male"   "Female" "Female" "Male"   "Female" "Female" "Female"
##  [673] "Female" "Female" "Male"   "Male"   "Male"   "Male"   "Male"  
##  [680] "Female" "Female" "Male"   "Male"   "Female" "Female" "Male"  
##  [687] "Male"   "Female" "Female" "Female" "Male"   "Female" "Male"  
##  [694] "Female" "Male"   "Female" "Female" "Male"   "Female" "Male"  
##  [701] "Female" "Female" "Female" "Male"   "Female" "Male"   "Male"  
##  [708] "Female" "Female" "Male"   "Female" "Male"   "Female" "Male"  
##  [715] "Female" "Female" "Male"   "Female" "Female" "Female" "Female"
##  [722] "Male"   "Female" "Male"   "Female" "Female" "Female" "Male"  
##  [729] "Female" "Female" "Female" "Female" "Female" "Female" "Female"
##  [736] "Female" "Female" "Male"   "Female" "Female" "Female" "Male"  
##  [743] "Male"   "Male"   "Female" "Female" "Male"   "Male"   "Male"  
##  [750] "Female" "Male"   "Female" "Male"   "Male"   "Female" "Female"
##  [757] "Female" "Female" "Female" "Female" "Male"   "Male"   "Female"
##  [764] "Male"   "Female" "Male"   "Female" "Male"   "Male"   "Male"  
##  [771] "Female" "Male"   "Male"   "Female" "Female" "Female" "Female"
##  [778] "Female" "Female" "Female" "Female" "Female" "Female" "Male"  
##  [785] "Female" "Male"   "Female" "Female" "Male"   "Male"   "Male"  
##  [792] "Female" "Female" "Female" "Female" "Male"   "Male"   "Male"  
##  [799] "Female" "Female" "Male"   "Female" "Female" "Female" "Female"
##  [806] "Male"   "Female" "Female" "Female" "Female" "Male"   "Female"
##  [813] "Male"   "Female" "Female" "Female" "Male"   "Male"   "Female"
##  [820] "Male"   "Male"   "Female" "Male"   "Female" "Male"   "Female"
##  [827] "Male"   "Male"   "Male"   "Female" "Male"   "Female" "Female"
##  [834] "Male"   "Female" "Male"   "Female" "Female" "Female" "Male"  
##  [841] "Male"   "Male"   "Female" "Male"   "Female" "Female" "Male"  
##  [848] "Male"   "Female" "Female" "Female" "Female" "Female" "Female"
##  [855] "Female" "Male"   "Male"   "Male"   "Male"   "Female" "Female"
##  [862] "Male"   "Female" "Male"   "Male"   "Female" "Female" "Male"  
##  [869] "Male"   "Male"   "Female" "Male"   "Male"   "Male"   "Female"
##  [876] "Female" "Female" "Female" "Female" "Female" "Male"   "Male"  
##  [883] "Female" "Male"   "Female" "Female" "Male"   "Male"   "Male"  
##  [890] "Female" "Male"   "Female" "Male"   "Male"   "Female" "Female"
##  [897] "Male"   "Male"   "Male"   "Male"   "Female" "Male"   "Female"
##  [904] "Male"   "Female" "Male"   "Female" "Male"   "Female" "Female"
##  [911] "Male"   "Female" "Female" "Female" "Female" "Male"   "Male"  
##  [918] "Female" "Female" "Female" "Female" "Female" "Female" "Male"  
##  [925] "Male"   "Female" "Male"   "Male"   "Female" "Female" "Female"
##  [932] "Female" "Male"   "Male"   "Male"   "Male"   "Male"   "Male"  
##  [939] "Male"   "Female" "Female" "Female" "Female" "Male"   "Female"
##  [946] "Female" "Female" "Female" "Female" "Female" "Male"   "Female"
##  [953] "Female" "Male"   "Male"   "Male"   "Male"   "Male"   "Female"
##  [960] "Female" "Male"   "Female" "Male"   "Male"   "Female" "Male"  
##  [967] "Female" "Male"   "Female" "Female" "Female" "Female" "Male"  
##  [974] "Male"   "Female" "Female" "Female" "Female" "Male"   "Male"  
##  [981] "Male"   "Male"   "Female" "Female" "Male"   "Male"   "Male"  
##  [988] "Female" "Male"   "Female" "Male"   "Female" "Female" "Female"
##  [995] "Female" "Female" "Female" "Female" "Male"   "Female" "Female"
## [1002] "Female" "Female" "Female" "Female" "Male"   "Female" "Male"  
## [1009] "Female" "Female" "Female" "Male"   "Female" "Male"   "Male"  
## [1016] "Female" "Female" "Female" "Female" "Male"   "Female" "Male"  
## [1023] "Female" "Male"   "Female" "Female" "Female" "Female" "Male"  
## [1030] "Male"   "Female" "Female" "Female" "Male"   "Male"   "Female"
## [1037] "Female" "Female" "Male"   "Male"   "Female" "Female" "Female"
## [1044] "Male"   "Male"   "Male"   "Male"   "Male"   "Male"   "Female"
## [1051] "Male"   "Female" "Male"   "Female" "Male"   "Female" "Female"
## [1058] "Male"   "Female" "Male"   "Female" "Female" "Female" "Male"  
## [1065] "Male"   "Male"   "Male"   "Male"   "Female" "Male"   "Female"
## [1072] "Male"   "Female" "Female" "Male"   "Female" "Male"   "Female"
## [1079] "Male"   "Male"   "Female" "Female" "Female" "Female" "Male"  
## [1086] "Male"   "Female" "Female" "Male"   "Male"   "Male"   "Female"
## [1093] "Female" "Female" "Female" "Male"   "Female" "Male"   "Female"
## [1100] "Female" "Female" "Male"   "Female" "Female" "Female" "Female"
## [1107] "Female" "Male"   "Male"   "Female" "Male"   "Female" "Female"
## [1114] "Male"   "Male"   "Male"   "Female" "Male"   "Female" "Female"
## [1121] "Female" "Male"   "Male"   "Male"   "Male"   "Male"   "Female"
## [1128] "Female" "Male"   "Female" "Female" "Female" "Female" "Male"  
## [1135] "Female" "Female" "Female" "Female" "Female" "Female" "Male"  
## [1142] "Female" "Male"   "Female" "Female" "Male"   "Female" "Male"  
## [1149] "Male"   "Male"   "Male"   "Female" "Male"   "Male"   "Female"
## [1156] "Male"   "Male"   "Male"   "Male"   "Male"   "Female" "Female"
## [1163] "Female" "Male"   "Male"   "Female" "Male"   "Female" "Female"
## [1170] "Male"   "Male"   "Male"   "Male"   "Male"   "Female" "Female"
## [1177] "Male"   "Male"   "Female" "Male"   "Male"   "Male"   "Female"
## [1184] "Male"   "Female" "Female" "Male"   "Female" "Male"   "Male"  
## [1191] "Male"   "Female" "Male"   "Female" "Female" "Female" "Female"
## [1198] "Male"   "Male"   "Female" "Female" "Male"   "Female" "Male"  
## [1205] "Female" "Male"   "Female" "Male"   "Female" "Male"   "Female"
## [1212] "Female" "Female" "Male"   "Male"   "Male"   "Female" "Male"  
## [1219] "Male"   "Male"   "Male"   "Female" "Male"   "Male"   "Female"
## [1226] "Male"   "Male"   "Male"   "Male"   "Female" "Female" "Female"
## [1233] "Female" "Female" "Male"   "Male"   "Female" "Female" "Female"
## [1240] "Male"   "Female" "Female" "Female" "Male"   "Male"   "Male"  
## [1247] "Female" "Male"   "Male"   "Male"   "Male"   "Female" "Female"
## [1254] "Male"   "Female" "Female" "Female" "Female" "Female" "Male"  
## [1261] "Female" "Female" "Female" "Male"   "Male"   "Male"   "Female"
## [1268] "Male"   "Male"   "Female" "Female" "Male"   "Male"   "Female"
## [1275] "Female" "Female" "Female" "Male"   "Female" "Female" "Female"
## [1282] "Female" "Male"   "Male"   "Female" "Male"   "Male"   "Female"
## [1289] "Female" "Male"   "Male"   "Male"   "Male"   "Male"   "Female"
## [1296] "Female" "Female" "Male"   "Male"   "Male"   "Male"   "Male"  
## [1303] "Female" "Male"   "Male"   "Female" "Female" "Male"   "Male"  
## [1310] "Female" "Female" "Female" "Male"   "Male"   "Male"   "Female"
## [1317] "Female" "Female" "Male"   "Male"   "Female" "Male"   "Male"  
## [1324] "Female" "Female" "Female" "Female" "Female" "Female" "Female"
## [1331] "Male"   "Female" "Male"   "Female" "Male"   "Female" "Female"
## [1338] "Female" "Female" "Male"   "Male"   "Female" "Male"   "Female"
## [1345] "Female" "Female" "Female" "Female" "Female" "Female" "Female"
## [1352] "Female" "Female" "Female" "Male"   "Male"   "Female" "Female"
## [1359] "Female" "Male"   "Male"   "Female" "Male"   "Female" "Male"  
## [1366] "Female" "Female" "Female" "Female" "Female" "Male"   "Female"
## [1373] "Male"   "Female" "Female" "Male"   "Female" "Female" "Male"  
## [1380] "Male"   "Female" "Male"   "Female" "Male"   "Male"   "Male"  
## [1387] "Female" "Female" "Female" "Male"   "Male"   "Female" "Female"
## [1394] "Female" "Male"   "Male"   "Female" "Male"   "Female" "Female"
## [1401] "Female" "Male"   "Female" "Male"   "Male"   "Female" "Male"  
## [1408] "Female" "Female" "Male"   "Female" "Female" "Female" "Female"
## [1415] "Female" "Male"   "Male"   "Female" "Male"   "Female" "Male"  
## [1422] "Male"   "Female" "Female" "Female" "Male"   "Male"   "Female"
## [1429] "Female" "Male"   "Female" "Female" "Male"   "Male"   "Male"  
## [1436] "Female" "Male"   "Female" "Female" "Female" "Male"   "Male"  
## [1443] "Female" "Male"   "Female" "Female" "Male"   "Female" "Male"  
## [1450] "Male"   "Female" "Female" "Male"   "Female" "Male"   "Male"  
## [1457] "Female" "Female" "Female" "Male"   "Female" "Female" "Male"  
## [1464] "Female" "Female" "Female" "Female" "Female" "Female" "Female"
## [1471] "Male"   "Female" "Male"   "Male"   "Male"   "Male"   "Female"
## [1478] "Male"   "Male"   "Male"   "Female" "Male"   "Male"   "Female"
## [1485] "Female" "Female" "Male"   "Male"   "Male"   "Male"   "Female"
## [1492] "Female" "Male"   "Male"   "Male"   "Male"   "Male"   "Male"  
## [1499] "Male"   "Female" "Female" "Male"   "Male"   "Female" "Male"  
## [1506] "Female" "Female" "Male"   "Male"   "Male"   "Male"   "Female"
## [1513] "Female" "Female" "Male"   "Female" "Male"   "Male"   "Male"  
## [1520] "Female" "Female" "Male"   "Female" "Male"   "Male"   "Male"  
## [1527] "Female" "Female" "Female" "Female" "Female" "Female" "Male"  
## [1534] "Male"   "Female" "Male"   "Female" "Male"   "Female" "Female"
## [1541] "Male"   "Female" "Female" "Male"   "Female" "Male"   "Female"
## [1548] "Male"   "Male"   "Female" "Female" "Male"   "Female" "Male"  
## [1555] "Male"   "Female" "Male"   "Female" "Female" "Male"   "Male"  
## [1562] "Male"   "Female" "Female" "Female" "Female" "Female" "Male"  
## [1569] "Male"   "Female" "Male"   "Female" "Female" "Male"   "Female"
## [1576] "Female" "Female" "Male"   "Female" "Male"   "Male"   "Male"  
## [1583] "Female" "Female" "Female" "Female" "Female" "Male"   "Female"
## [1590] "Female" "Female" "Female" "Female" "Male"   "Female" "Female"
## [1597] "Female" "Male"   "Female" "Female" "Female" "Male"   "Male"  
## [1604] "Female" "Female" "Female" "Female" "Female" "Male"   "Female"
## [1611] "Male"   "Female" "Male"   "Male"   "Female" "Female" "Male"  
## [1618] "Male"   "Male"   "Female" "Female" "Male"   "Male"   "Male"  
## [1625] "Female" "Male"   "Female" "Female" "Female" "Male"   "Female"
## [1632] "Female" "Male"   "Female" "Male"   "Male"   "Female" "Female"
## [1639] "Male"   "Female" "Male"   "Female" "Female" "Female" "Female"
## [1646] "Female" "Female" "Female" "Female" "Male"   "Female" "Female"
## [1653] "Female" "Male"   "Female" "Female" "Female" "Male"   "Female"
## [1660] "Male"   "Female" "Female" "Male"   "Female" "Female" "Male"  
## [1667] "Female" "Male"   "Male"   "Male"   "Female" "Male"   "Female"
## [1674] "Male"   "Female" "Female" "Male"   "Male"   "Male"   "Male"  
## [1681] "Female" "Female" "Male"   "Male"   "Male"   "Female" "Female"
## [1688] "Male"   "Female" "Female" "Female" "Female" "Male"   "Female"
## [1695] "Male"   "Male"   "Male"   "Female" "Male"   "Female" "Female"
## [1702] "Female" "Male"   "Female" "Male"   "Female" "Male"   "Male"  
## [1709] "Male"   "Male"   "Male"   "Male"   "Male"   "Male"   "Female"
## [1716] "Female" "Male"   "Female" "Male"   "Male"   "Female" "Male"  
## [1723] "Male"   "Male"   "Female" "Female" "Male"   "Male"   "Female"
## [1730] "Male"   "Male"   "Female" "Male"   "Male"   "Female" "Female"
## [1737] "Female" "Female" "Female" "Female" "Male"   "Male"   "Male"  
## [1744] "Male"   "Female" "Female" "Male"   "Male"   "Male"   "Female"
## [1751] "Female" "Female" "Male"   "Male"   "Female" "Male"   "Female"
## [1758] "Female" "Female" "Female" "Male"   "Male"   "Male"   "Male"  
## [1765] "Female" "Male"   "Female" "Female" "Female" "Male"   "Male"  
## [1772] "Male"   "Female" "Male"   "Female" "Male"   "Male"   "Male"  
## [1779] "Male"   "Male"   "Male"   "Female" "Female" "Female" "Male"  
## [1786] "Female" "Male"   "Male"   "Male"   "Female" "Female" "Female"
## [1793] "Female" "Female" "Female" "Female" "Female" "Female" "Female"
## [1800] "Male"   "Female" "Male"   "Female" "Male"   "Male"   "Female"
## [1807] "Female" "Female" "Female" "Female" "Female" "Male"   "Female"
## [1814] "Male"   "Male"   "Male"   "Female" "Male"   "Female" "Male"  
## [1821] "Male"   "Female" "Male"   "Male"   "Female" "Female" "Female"
## [1828] "Female" "Male"   "Female" "Male"   "Male"   "Female" "Male"  
## [1835] "Male"   "Female" "Female" "Female" "Female" "Female" "Male"  
## [1842] "Female" "Female" "Male"   "Male"   "Male"   "Male"   "Male"  
## [1849] "Male"   "Male"   "Male"   "Female" "Female" "Male"   "Male"  
## [1856] "Male"   "Female" "Female" "Male"   "Male"   "Female" "Female"
## [1863] "Female" "Male"   "Female" "Male"   "Female" "Male"   "Male"  
## [1870] "Male"   "Male"   "Female" "Female" "Male"   "Male"   "Female"
## [1877] "Female" "Female" "Female" "Female" "Female" "Female" "Female"
## [1884] "Male"   "Male"   "Male"   "Male"   "Male"   "Female" "Male"  
## [1891] "Female" "Male"   "Female" "Male"   "Female" "Female" "Female"
## [1898] "Male"   "Female" "Male"   "Female" "Male"   "Female" "Female"
## [1905] "Female" "Male"   "Male"   "Male"   "Female" "Male"   "Female"
## [1912] "Male"   "Male"   "Female" "Female" "Female" "Male"   "Male"  
## [1919] "Male"   "Male"   "Female" "Male"   "Female" "Female" "Male"  
## [1926] "Female" "Female" "Female" "Female" "Male"   "Male"   "Male"  
## [1933] "Female" "Male"   "Female" "Female" "Male"   "Female" "Male"  
## [1940] "Female" "Female" "Male"   "Male"   "Female" "Male"   "Female"
## [1947] "Female" "Male"   "Female" "Female" "Female" "Male"   "Female"
## [1954] "Female" "Male"   "Female" "Female" "Male"   "Male"   "Female"
## [1961] "Male"   "Male"   "Female" "Female" "Female" "Female" "Male"  
## [1968] "Female"

Now we can assign it to the real variable

ess6$gender <- recodeVar(ess6$gndr, src=c(1,2), tgt=c("Male", "Female"))

And see the result in a crosstab

t1 <- table(ess6$gender, ess6$lrscale)
t1
##         
##            0   1   2   3   4   5   6   7   8   9  10  77  88
##   Female  66  25  67 120  94 288  77  98 104  32  50  23  43
##   Male    55  27  71  75  80 229  63  83  80  23  49  21  25

Same process for the political placement

recodeVar(ess6$lrscale, src=c(77,88), tgt= c(NA, NA) )
##    [1]  5  8  9 10 NA  5  5  8  2  5  5  4  9  5  8 10  7  5  7 NA  5  6 NA
##   [24]  4  3  1  5  5  1  7 10  4  5  6  4  3  8  2 10  9  6  6  5  5  5  4
##   [47]  5  5  9  5  9  3 10  2  2  3 NA  5  7  3  8  4  5  2  3  7  8  5  6
##   [70]  5  4  3  3 NA 10  5  8  4  5  4  5  6  5  4 10  7  7 10  7  5  2  7
##   [93]  6  5  3  8  8  8 10  6  7  5  6  5  4  6 NA  2  5 10  8  5  0  5  5
##  [116]  5  3  3 NA  0  6  5 10  5  5  5 NA  6  5  9  5  7  8  4  7  7  7  5
##  [139]  5  3  4  9  7  4  5  5 NA  3  5  5  8  6 10  2  5  8  7  3  7  6  5
##  [162]  3  7  2 10  5 NA  7  5  9  4  2  2 10  7  0 10  9  6  8  6 NA  6  5
##  [185]  5  2  7  3  3  3  8  5  5  7  6  3  5  5  3  8  5  3  7  2  6 NA  5
##  [208]  8  2  8  5  5  2  3  6  3  0  5  2  7  5  8  3  3  3  5  7  9  8  5
##  [231]  3  4 10  5  8  5  5  7  6  3  5  6  6  6  5  6  4  4  1  3  5 NA  7
##  [254] NA  7  2  5  2  1 NA  9  2 NA  5  5  8  5  5  6  4  2  5 NA  9  7  0
##  [277]  6  5  8  8  0  7  4  6  0  5  4  4  0  9 NA  3  4  7  5  8  0  6  4
##  [300]  5 NA  5  5  4  6  5  2  1 NA  0  2  2 NA  8  7  8  9 NA  8  6  9  4
##  [323]  8 NA  1  5 NA  1  8 NA  3  6  8  3  4  4  8  3  5  7  4  7  5  3  7
##  [346]  7  2  0  3  2 NA  5  2  3  7 10  5  5  8  5  3  7  8 NA NA  4  4  5
##  [369]  5  5 10  5  7  8  4  6  3  3  5  5  5  5  5  5 10  3  5  5  4 10  5
##  [392]  5  4  5 NA NA  8  5  6  9  8  0  5  5 10  5  0  2  2  0  5  5  5  8
##  [415]  5  5  9  3  6  5  1  0  5  5  5  3  5  5  4  3  1  7  5  4 10  5  5
##  [438]  2  5  5  5  5  1  5  5  2  3  6  4 NA  3  4 NA  8  0  8  5  1  6  5
##  [461]  2  2  5  7  5  5  5  5  5  5  8  3  5  6  4  5  2  5  5  5  3  4 NA
##  [484]  5 10  3  4  4  2  5  4  5 10  5  2 10  4  7  5 10  2  5  1  5  3  6
##  [507]  2  5  0  6  7  0 NA  5 NA  0  5  6  4  2  4  6  5  5  9  8  4  5  0
##  [530] NA NA  2 NA  2  3  5  6 NA  5  9  4  1  5  7  8  0  8  5  0  0  4  4
##  [553]  0  5  3  5  8  4  2  6 NA  5  5 NA  6  8  5  3 10  7  5  5  5  6  5
##  [576]  3  5  4  7  7  8  6  5 10  8  5  5  4  7  3  2  5  4  0  5  0  6  1
##  [599] 10  3  4  9  0  9  3  4  6  5  7  5  7  5 NA  8  0  3  8  5 NA  1  6
##  [622]  5  8  2  3  1  4  2 NA NA  3  7  8  4  4  3  1  4  3 NA  4  3  3  4
##  [645] NA  4  7  7  6 10  6  5  7  5  8  6  3  5  0 10  3  6  5  2  7  2 NA
##  [668] NA  8  8  7  5  5  6  5  5  5  3  2  5  7  6  6  5  5  9  7 NA  4  7
##  [691] NA  2  5  4  5  4  4 NA  3  3  2  8 NA  3  0  4  3  1 NA  4  2  1  4
##  [714]  9  5  2  5  3  5  4  5  3 10  3  4  5  2  3  3  2  3  0  8  0  5  5
##  [737]  0  4 10  3  3  4  9  5 NA NA  3  5 NA  5 NA NA  3 10  7  6  8  6  3
##  [760]  4  4  5  5  4  8  2  6  5  1  9  5 10 10 NA  5  8  0  7  0 NA  7  7
##  [783]  0  4  5  4  5  2  7 10  8  3  0  5  5  7  3 10  3  2  8  5  4  5  7
##  [806]  8  4  8  5  5  5 10  5  4  4 10  2  3  8  7  5  6  5  3  0  4  5  7
##  [829]  8  5  0  2  7 10  6  7  8  7  4  8  2  5 NA  7  6  5  7  7  5  5  8
##  [852]  0  4  4  5  5 10  4  7  5  4  3  4  3 10  8  4  6  2  2  2  4  5  7
##  [875]  3  5  3  3  2  2  8  3  5  2  2  8  4  5 NA  2 10  5  7  1 NA 10  8
##  [898]  9  4  4  3  5  5  8  6  5  6  4  3  3  8 NA 10  5  5  1  5  8  7  5
##  [921]  3  7  5  8  6  6  8  2  5  8  7  4  8  4 10  7  8  5  5  5 10  7  0
##  [944] 10  8  2  8  5  4  5  5  5  5  5  9  5  0  8  4  5  5  3  8  2  9  7
##  [967]  2 10  6  7  5  8  4  3  7  0  5  3 10  0  8  8  5  5 10  2  8  3  1
##  [990]  0  9  2  0  0  8  8 10  5  3  5  3  8  7  5  7  3  4  2  2  5  2  2
## [1013]  9  0  5  8 10  3  5  7  1  4  5  5  5  1  5  0  5  2  5  7  0 10  0
## [1036]  8  6  3  5  0  8  1  1  6  5  2  8  4  2  5  5  5  8  8  7  8 NA  2
## [1059]  5 NA  6  9 10 NA  6  1  5  4  3  4  3  3  5  9  8 10  0  5  5  2  6
## [1082]  8  9  5  3 10  3  5  5  5  4  5  5  7  5  6  9  0  5  5  5  6  5 10
## [1105]  2  5  8  4  3  0  6  0  8  5  7  5  3  7  6  5  5  7  6 NA 10  5  0
## [1128]  6  6  8  4  6  1  5  5  5  5  3  7  5 NA  5  5  2  4  7  5  4  8  6
## [1151]  5  3  8  3  2  7  2  5  0  6  5  0  5  5  5  2  5 10  0  5  2  0  6
## [1174]  7  5  1  8 10  5  5  3  7  7  8 10  5  7  2  7  8  9  8  0  7  6  6
## [1197]  5  7  7  3  5  2  5  3 10  5  3  5  7  1  8  7  6  6  5  8  8 NA 10
## [1220]  6  6  7  7  8  7  7  4  8 10 NA  5  5  3  3  8 10  9  2  6  5  8  0
## [1243]  5 10  7  8  1  7  5  7  6  3  3  7  5  7  5  6  8  6  4  3  2  5  7
## [1266]  5  7 NA 10  2  6  0  5  5  3  5  7  1  8  5  5  8  5  7  8  3  2  6
## [1289]  5  3  8  2  3 NA  1  7  4 NA  0  6  5 10  2  8  8  7  4  8  8  5  9
## [1312]  0  0  0  3  0  7  3 10  3  4  5  7  7  7  5  5  5  4  8  6  4  0  0
## [1335]  3 NA  7 NA  8  7  8 NA  5  5  4  9  1  3  5  5  0  0  3  0 NA NA  5
## [1358]  5 10  5  8  5  5  8  5  5  5  5 NA  4  7  5  3  5  3  3  5  3  8  7
## [1381]  9  6  6  5  5  4  5  5  5  3  5  6 10  3  7  8 NA  5  7  8  6 NA  3
## [1404] NA  7  2  7  5  8  2  0  2  2  8  8  2  3  5  5  3  4  5  3  0  2  5
## [1427]  8  8  5  4  4  3  2  3  3  0  5  2  2  0  2  0  4  6  5  6  1  8  7
## [1450]  5  6  7  5  0  5  3  2  5 10  5  7  8  7  7  4  5  5  5  0  5  3  7
## [1473]  7  0  3  2  4  4  4  8  6  5  2  4  0  2  6  2  7  3 10  5  0  4  5
## [1496]  5 NA  7  5  0  4  5  1  5  5  6 10  9  2  0  4  5  7 NA  0  1  1 NA
## [1519]  1  3  6  6  4  7  0  6  8  0  7  5  3  1  6  5  7  1  8  4  7  5  5
## [1542]  6  5  2  6  8  5  8  5  5  7  5  5  5  5  0  0  5 10  7  5  3 NA 10
## [1565]  5  6  7  4  5  8  3  6  5  5  8  3 NA  5  5  2  4  3  5 NA  8  3  5
## [1588] NA  0  5  5  6 10  5  9  5  0  5 10  7  5  7  5  8  2  5  0  3  5  7
## [1611]  0  5 10  8  5  1  4  5  6  3  3  5  5  8  5  0  6  0  3  5  0  0  8
## [1634]  8  0  4  5  5  7 10  0  9 NA NA  4  6  3  3  9  5  2  9  4 NA  3  5
## [1657]  4  5  4  5 NA  4  5  5  0 10  1  0  7  0  3  9  5  8  5  5  8 NA  4
## [1680] NA  5  6  5  3  5  7  7  5  3  9  0 10  2  5  9  3  2  8 10  7  5 NA
## [1703]  4  8  0  8 10  5  4 NA  0  0  8  8  5 NA  3  8 NA  5  9  2  5  0  9
## [1726] 10  5  7 10 10  2  7  4  4  5  6  8  7  5  7  7  5  2  8  5 NA  4 10
## [1749] 10  4  2  8  5  7  2  5  5  8  2  1  3  1  7  4  0  6 NA  7  5  5  7
## [1772]  5  8  2  4  1  3 NA  2  1 NA  5  7  3  0  6  4  7  6  4 NA  5  3  6
## [1795]  5  4  5  5  8  3  5  3  7  2  4  7  3  3  5  5  6  2  5  5  1  3  3
## [1818]  6 10  5  6  4  3  3  5  5  3  5  5  5  5  9  3  6  7 10  0  1  8  5
## [1841]  4  4  8  7  1  0  6  5  7  2  0  5  9  3  8  2  3  5  5  0  2  6  8
## [1864]  5  6  4  5  2  5  5  5  5  8  4  0 NA  0  6  0  5  3  8  2  4  5  2
## [1887]  4  5 10  2  8  5 NA  7  8  2  9  4  6  5  5  0  3  4  5  5  6  5  4
## [1910]  3  3  5 10  6  5  5  0  5  3  4  8  8  6  8  5  7  5  5  3 NA 10  1
## [1933]  9  3 10  8  3  7  9  5  6  5  7 NA  2  7  4 NA  4 10  5  7  8  5  5
## [1956]  0  8 10  5  2 NA  5  4  4  3  9  4  4
ess6$p2 <- recodeVar(ess6$lrscale, src=c(77,88), tgt= c(NA, NA) )

We can look at the gender x political placement table

t1 <- table(ess6$gender, ess6$p2)
t1
##         
##            0   1   2   3   4   5   6   7   8   9  10
##   Female  66  25  67 120  94 288  77  98 104  32  50
##   Male    55  27  71  75  80 229  63  83  80  23  49

We make sure that p2 is numeric

ess6$p2 <- as.numeric(ess6$p2)
t1 <- table(ess6$gender, ess6$p2)
t1
##         
##            0   1   2   3   4   5   6   7   8   9  10
##   Female  66  25  67 120  94 288  77  98 104  32  50
##   Male    55  27  71  75  80 229  63  83  80  23  49

We can store those values in a data frame. It will display the frequency linked to each combination of variables modalities.

df1 <- as.data.frame(t1)
df1
##      Var1 Var2 Freq
## 1  Female    0   66
## 2    Male    0   55
## 3  Female    1   25
## 4    Male    1   27
## 5  Female    2   67
## 6    Male    2   71
## 7  Female    3  120
## 8    Male    3   75
## 9  Female    4   94
## 10   Male    4   80
## 11 Female    5  288
## 12   Male    5  229
## 13 Female    6   77
## 14   Male    6   63
## 15 Female    7   98
## 16   Male    7   83
## 17 Female    8  104
## 18   Male    8   80
## 19 Female    9   32
## 20   Male    9   23
## 21 Female   10   50
## 22   Male   10   49

Then we load the vcd library

library(vcd)
## Loading required package: grid

We can make it a mosaic plot. Swapping the variables will exchange rows and columns.

mosaicplot(ess6$gender ~ ess6$p2)

mosaicplot( ess6$p2 ~ ess6$gender)

We can add shading to the mosaicplot to make the results clearer.

mosaicplot( ess6$p2 ~ ess6$gender, shade=T)

To make another table, we can look at the column names (each column = a variable)

colnames(ess6)
##   [1] "cntry"    "cname"    "cedition" "cproddat" "cseqno"   "name"    
##   [7] "essround" "edition"  "idno"     "dweight"  "pspwght"  "pweight" 
##  [13] "tvtot"    "tvpol"    "rdtot"    "rdpol"    "nwsptot"  "nwsppol" 
##  [19] "netuse"   "ppltrst"  "pplfair"  "pplhlp"   "polintr"  "polcmpl" 
##  [25] "poldcs"   "trstprl"  "trstlgl"  "trstplc"  "trstplt"  "trstprt" 
##  [31] "trstep"   "trstun"   "vote"     "contplt"  "wrkprty"  "wrkorg"  
##  [37] "badge"    "sgnptit"  "pbldmn"   "bctprd"   "clsprty"  "prtdgcl" 
##  [43] "mmbprty"  "lrscale"  "stflife"  "stfeco"   "stfgov"   "stfdem"  
##  [49] "stfedu"   "stfhlth"  "gincdif"  "freehms"  "prtyban"  "scnsenv" 
##  [55] "euftf"    "imsmetn"  "imdfetn"  "impcntr"  "imbgeco"  "imueclt" 
##  [61] "imwbcnt"  "happy"    "sclmeet"  "inmdisc"  "sclact"   "crmvct"  
##  [67] "aesfdrk"  "brghmwr"  "brghmef"  "crvctwr"  "crvctef"  "trrenyr" 
##  [73] "trrcnyr"  "trrprsn"  "trrtort"  "health"   "hlthhmp"  "rlgblg"  
##  [79] "rlgdnm"   "rlgblge"  "rlgdnme"  "rlgdgr"   "rlgatnd"  "pray"    
##  [85] "dscrgrp"  "dscrrce"  "dscrntn"  "dscrrlg"  "dscrlng"  "dscretn" 
##  [91] "dscrage"  "dscrgnd"  "dscrsex"  "dscrdsb"  "dscroth"  "dscrdk"  
##  [97] "dscrref"  "dscrnap"  "dscrna"   "ctzcntr"  "ctzship"  "ctzshipa"
## [103] "ctzshipb" "ctzshipc" "brncntr"  "cntbrth"  "cntbrtha" "cntbrthb"
## [109] "cntbrthc" "livecntr" "livecnta" "lnghoma"  "lnghom1"  "lnghomb" 
## [115] "lnghom2"  "blgetmg"  "facntr"   "facntn"   "fbrncnt"  "fbrncnta"
## [121] "fbrncntb" "mocntr"   "mocntn"   "mbrncnt"  "mbrncnta" "mbrncntb"
## [127] "gndr"     "partner"  "rshpsts"  "marsts"   "marital"  "martlfr" 
## [133] "maritala" "maritalb" "lvghw"    "lvghwa"   "lvgoptn"  "lvgptn"  
## [139] "lvgptna"  "lvgptne"  "lvgptnea" "dvrcdev"  "dvrcdeva" "chldhm"  
## [145] "chldhhe"  "domicil"  "edulvla"  "edulvlb"  "eisced"   "edufld"  
## [151] "eduyrs"   "pdwrk"    "edctn"    "uempla"   "uempli"   "dsbld"   
## [157] "rtrd"     "cmsrv"    "hswrk"    "dngoth"   "dngdk"    "dngref"  
## [163] "dngna"    "mainact"  "mnactic"  "crpdwk"   "pdjobev"  "pdjobyr" 
## [169] "emplrel"  "emplno"   "wrkctr"   "wrkctra"  "estsz"    "jbspv"   
## [175] "njbspv"   "wkdcorg"  "wkdcorga" "iorgact"  "wkhct"    "wkhtot"  
## [181] "nacer1"   "nacer11"  "nacer2"   "tporgwk"  "iscoco"   "isco08"  
## [187] "wrkac6m"  "uemp3m"   "uemp12m"  "uemp5yr"  "mbtru"    "hincsrc" 
## [193] "hincsrca" "hinctnt"  "hinctnta" "hincfel"  "brwmny"   "edulvlpa"
## [199] "edulvlpb" "eiscedp"  "pdwrkp"   "edctnp"   "uemplap"  "uemplip" 
## [205] "dsbldp"   "rtrdp"    "cmsrvp"   "hswrkp"   "dngothp"  "dngdkp"  
## [211] "dngnapp"  "dngrefp"  "dngnap"   "mnactp"   "crpdwkp"  "iscocop" 
## [217] "isco08p"  "emprelp"  "emplnop"  "jbspvp"   "njbspvp"  "wkdcorp" 
## [223] "ioactp"   "wkhtotp"  "edulvlfa" "edulvlfb" "eiscedf"  "emprf14" 
## [229] "emplnof"  "jbspvf"   "occf14"   "occf14a"  "occf14b"  "edulvlma"
## [235] "edulvlmb" "eiscedm"  "emprm14"  "emplnom"  "jbspvm"   "occm14"  
## [241] "occm14a"  "occm14b"  "atncrse"  "fxltph"   "mbltph"   "inttph"  
## [247] "X"        "gender"   "p2"

Eisced : levels of education

ess6$eisced
##    [1]  3  3  3  5  3  4  3  7  6  7  7  7  7  2  7  1  3  5  1  7  3  7  3
##   [24]  3  7  6  3  6  6  1  3  3  4  4  7  7  2  3  4  6  7  7  1  5  3  1
##   [47]  1  4  1  4  3  3  2  4  5  3  7  3  7  3  1  3  1  5  4  4  2  3  3
##   [70]  4  2  1  5  6  3  1  7  3  3  4  1  5  3  1  1  4  3  4  1  3  1  2
##   [93]  4  3  3  1  1  3  1  1  1  3  4  7  4  5  3  1  7  2  1  3  3  1  3
##  [116]  1  3  4  1  3  2  6  3  1  1  4  3  5  4  2  3  4  2  7  7  7  5  4
##  [139]  4  7  5  4  4  4  3  1  2  3  3  1  3  4  1  1  2  4  7  7  1  7  1
##  [162]  5  3  3  3  1  5  3  4  2  3  7  7  4  5  3  1  1  1  1  3  3  4  3
##  [185]  7  5  4  3  5  7  4  3  1  3  5  3  2  7  4  1  1  3  2  7  7  1  7
##  [208]  7  4  1  1  5  1  4  5  2  3  1  3  7  3  4  1  5  4  3  7  1  1  2
##  [231]  4  3  1  3  3  3  3  4  4  5  6  3  3  4  7  1  7  7  2  7  7  3  3
##  [254]  3  1  6  4  5  2  1  4  5  3  3  4  1  4  3  5  3  5  1  3  2  4  3
##  [277]  4  6  5  1  4  3  5  6  5  3  7  6  2  2  1  4  4  5  3  1  3  1  3
##  [300]  2  1  5  3  3  6  1  3  3  2  3  1  4  2  4  5  4  4  1  4  1  4  1
##  [323]  1  6  5  4  3  6  4  1  4  1  4  5  3  3  3  7  5  1  2  4  5  3  1
##  [346]  3  4  1  6  3  1  3  4  4  4  1  1  1  1  4  7  1  1  1  5  4  5  3
##  [369]  3  5  5  2  6  7  5  3  4  6  1  1  1  2 55  3  2  4  2  3  5  3  6
##  [392]  2  3  5  3  1  4  5  5  5  5  2  7  4  3  2  4  4  4  3  3  2  2  4
##  [415]  7  4  3  7  1  1  5  7  1  4  3  3  2  5  4  7  7  4  5  3  5  1  3
##  [438]  2  1  2  1  1  2  5  7  4  3  4  5  4  4  1  5  7  4  1  5  7  5  3
##  [461]  6  1  7  2  7  2  1  5  1  3  7  4  1  7  3  1  7  4  5  4  1  5  3
##  [484]  3  3  3  3  5  2  7  1  1  7  1  3  3  1  1  1  1  1  2  7  4  5  4
##  [507]  5  3  3  2  1  5  3  5  3  7  1  5  5  6  5  5  7  4  7  5  5  1  5
##  [530]  3  7  5  2  5  2  2  3  3  2  2  4  2  1  2  2  5  7  4  3  4  5  4
##  [553]  7  5  5  4  4  5  5  7  6  7  4  5  6  4  3  3  3  1  3  4  3  5  1
##  [576]  5  5  2  3  1  1  3  5  1  4  3  4  1  1  5  6  3  4  2  7  5  1  5
##  [599]  3  7  1  2  6  2  3  5  4  1  5  1  4  4  4  3  4  5  3  3  3  3  6
##  [622]  3  4  4  1  2  3  3  1  3  3  1  5  1  3  7  6  1  4  3  4  1  6  7
##  [645]  3  1  2  1  3  4  1  1  1  4  4  1  1  3  1  3  1  1  4  5  3  7  1
##  [668]  5  1  5  3  2  3  5  3  4  4  3  3  1  3  4  1  2  1  7  1  3  3  2
##  [691]  3  3  4  1  1  7  5  2  2  3  2  5  3  3  3  1  3  2  3  4  7  3  4
##  [714]  3  1  7  6  5  2  5  1  4  4  3  4  3  4  6  1  2  2  7  2  2  2  3
##  [737]  4  5  4  3  5  7  4  3  3  3  3  3  3  3  3  4  5  1  3  2  7  4  4
##  [760]  3  4  3  4  3  1  5  4  3  4  4  3  3  2  1  1  2  3  1  7  3  1  5
##  [783]  5  3  3  4  1  4  2  1  3  3  5  3  3  6  3  3  4  5  3  3  3  1  1
##  [806]  1  5  5  4  4  1  3  3  2  2  4  1  4  2  5  3  4  3  3  1  1  1  2
##  [829]  3  1  4  3  1  1  3  4  4  4  1  2  4  3  4  6  5  2  5  4  1  7  2
##  [852]  6  7  1  1  7  3  4  5  1  1  3  4  7  1  6  1  4  3  3  1  7  4  3
##  [875]  5  5  4  4  4  4  4  1  6  5  7  6  5  7  1  4  3  3  3  1  4  2  3
##  [898]  3  3  7  1  4  3  5  1  2  4  3  7  3  3  7  4  3  1  6  3  4  4  1
##  [921]  1  5  1  3  3  6  1  4  7  4  1  3  4  6  5  3  5  3  3  3  6  3  1
##  [944]  3  1  1  3  3  2  2  3  4  1  4  1  5  5  7  5  3  3  7  3  6  1  3
##  [967]  2  1  2  4  1  1  5  4  5  4  1  6  3  3  1  1  4  6  1  3  4  1  1
##  [990]  4  4  3  3  7  5  6  1  7  7  7  1  5  1  4  3  3  3  1  4  4  5  3
## [1013]  7  3  2  7  2  4  5  4  1  7  1  1  3  5  5  1  4  4  1  3  3  3  1
## [1036]  5  1  7  4  3  1  3  7  3  6  4  1  5  6  4  3  3  7  1  7  5  3  4
## [1059]  3  1  2  2  1  4  1  7  3  3  4  3  4  3  3  3  1  2  1  4  2  3  3
## [1082]  2  7  7  3  4  5  4  7  3  3  5  1  3  3  5  2  1  1  1  4  5  3  1
## [1105]  1  3  4  5  3  1  1  3  1  1  5  1  3  3  1  3  4  4  7  1  1  4  2
## [1128]  3  7  4  4  4  7  4  3  7  3  7  5  3  5  3  3  3  1  1  3  3  1  4
## [1151]  3  6  1  3  2  3  4  1  2  3  4  3  3  7  1  2  3  1  4  2  3  2  1
## [1174]  3  4  3  1  5  1  1  2  5  3  6  3  1  3  7  3  1  5  1  2  1  7  4
## [1197]  3  3  1  7  3  5  7  6  1  7  7  1  5  1  4  3  4  5  1  3  1  3  5
## [1220]  3  4  3  3  3  3  5  5  4  3  3  5  1  5  6  1  1  1  4  2  4  3  4
## [1243]  5  7  4  6  5  4  5  7  7  1  7  3  5  3  4  2  1  1  1  4  5  4  5
## [1266]  7  2  6  1  7  7  2  4  1  5  4  6  7  3  5  7  1  3  4  7  4  5  2
## [1289]  4  3  5  6  1  5  6  3  5  3  7  5  3  7  6  3  5  2  1  7  4  5  3
## [1312]  6  3  1  2  2  3  4  4  5  6  3  7  1  4  4  2  2  1  4  5  1  1  4
## [1335]  7  1  7  4  3  3  3  2  1  5  1  1  7  1  4  3  4  1  1  5  3  1  1
## [1358]  4  3  3  1  5  2  4  3  1  1  3  2  7  1  4  4  1  3  4  2  7  3  3
## [1381]  1  5  3  3  1  1  1  5  4  4  3  1  4  5  5  5  4  1  1  4  5  2  7
## [1404]  5  3  4  4  4  3  7  4  5  6  3  3  3  3  5  7  6  4  4  7  7  7  7
## [1427]  7  7  7  7  5  7  2  6  2  2  4  4  7  7  4  4  7  7  3  5  7  1  6
## [1450]  7  7  5  4  7  2  4  7  4  5  7  4  5  5  7  2  6  3  1  7  4  6  7
## [1473]  7  3  7  6  7  2  2  7  7  4  4  4  5  5  3  3  2  3  4  3  1  3  1
## [1496]  3  3  3  3  3  1  1  7  2  3  2  3  1  6  5  5  1  3  4  1  7  1  1
## [1519]  3  3  7  4  5  2  2  1  5  3  1  1  5  7  3  4  3  3  7  5  3  1  5
## [1542]  5  4  7  5  3  4  4  2  1  1  7  4  4  3  4  5  3  5  7  7  7  1  4
## [1565]  2  4  3  5  6  5  5  4  7  4  3  5  3  6  1  5  4  5  1  6  2  4  4
## [1588]  4  1  1  4  7  7  3  4  1  3  2  3  3  3  2  3  3  5  4  1  3  1  1
## [1611]  4  1  2  1  3  4  7  1  7  4  2  3  4  2  3  1  5  1  7  3  3  3  5
## [1634]  1  3  3  7  2  1  1  3  1  1  1  5  5  3  1  1  3  5  3  5  3  7  3
## [1657]  1  4  6  3  4  1  5  3  4  2  2  1  3  3  5  3  3  3  4  5  3  6  4
## [1680]  6  1  2  5  5  1  5  6  3  5  3  4  4  4  2  3  5  5  5  2  6  7  2
## [1703]  1  3  3  3  1  7  5  1  1  1  6  4  5  1  3  7  4  4  1  5  3  3  2
## [1726]  5  5  4  5  1  3  5  3  6  4  4  1  3  1  7  3  1  7  4  5  1  5  5
## [1749]  3  5  1  5  3  1  7  1  3  3  3  5  7  4  4  7  4  2  4  4  2  4  4
## [1772]  1  4  1  4  3  1  1  4  3  2  3  5  1  3  2  4  5  3  3  3  1  1  5
## [1795]  6  1  3  1  7  3  1  1  4  2  2  4  5  5  4  2  1  3  2  6  7  4  3
## [1818]  2  5  7  7  2  2  7  7  6  3  7  1  1  1  3  5  4  7  4  2  5  3  2
## [1841]  3  1  6  7  7  5  6  7  2  6  3  3  5  3  5  3  4  3  5  3  6  2  7
## [1864]  1  5  4  1  1  4  2  1  3  1  1  4  6  5  1  6  6  5  3  7  4  4  2
## [1887]  3  2  4  7  2  2  2  6  4  7  2  7  1  4  1  5  4  3  4  3  4  5  3
## [1910]  1  3  2  5  4  4  3  4  7  7  7  2  4  5  5  5  4  4  1  3  1  2  4
## [1933]  1  1  4  4  5  7  3  3  7  4  4  3  5  3  3  1  3  1  4  1  3  3  5
## [1956]  5  4  3  3  7  4  2  2  4  3  1  5  7
table(ess6$eisced)
## 
##   1   2   3   4   5   6   7  55 
## 390 174 482 350 263  87 221   1

Recoding

recodeVar(ess6$eisced, src=c(55), tgt= c(NA) )
##    [1]  3  3  3  5  3  4  3  7  6  7  7  7  7  2  7  1  3  5  1  7  3  7  3
##   [24]  3  7  6  3  6  6  1  3  3  4  4  7  7  2  3  4  6  7  7  1  5  3  1
##   [47]  1  4  1  4  3  3  2  4  5  3  7  3  7  3  1  3  1  5  4  4  2  3  3
##   [70]  4  2  1  5  6  3  1  7  3  3  4  1  5  3  1  1  4  3  4  1  3  1  2
##   [93]  4  3  3  1  1  3  1  1  1  3  4  7  4  5  3  1  7  2  1  3  3  1  3
##  [116]  1  3  4  1  3  2  6  3  1  1  4  3  5  4  2  3  4  2  7  7  7  5  4
##  [139]  4  7  5  4  4  4  3  1  2  3  3  1  3  4  1  1  2  4  7  7  1  7  1
##  [162]  5  3  3  3  1  5  3  4  2  3  7  7  4  5  3  1  1  1  1  3  3  4  3
##  [185]  7  5  4  3  5  7  4  3  1  3  5  3  2  7  4  1  1  3  2  7  7  1  7
##  [208]  7  4  1  1  5  1  4  5  2  3  1  3  7  3  4  1  5  4  3  7  1  1  2
##  [231]  4  3  1  3  3  3  3  4  4  5  6  3  3  4  7  1  7  7  2  7  7  3  3
##  [254]  3  1  6  4  5  2  1  4  5  3  3  4  1  4  3  5  3  5  1  3  2  4  3
##  [277]  4  6  5  1  4  3  5  6  5  3  7  6  2  2  1  4  4  5  3  1  3  1  3
##  [300]  2  1  5  3  3  6  1  3  3  2  3  1  4  2  4  5  4  4  1  4  1  4  1
##  [323]  1  6  5  4  3  6  4  1  4  1  4  5  3  3  3  7  5  1  2  4  5  3  1
##  [346]  3  4  1  6  3  1  3  4  4  4  1  1  1  1  4  7  1  1  1  5  4  5  3
##  [369]  3  5  5  2  6  7  5  3  4  6  1  1  1  2 NA  3  2  4  2  3  5  3  6
##  [392]  2  3  5  3  1  4  5  5  5  5  2  7  4  3  2  4  4  4  3  3  2  2  4
##  [415]  7  4  3  7  1  1  5  7  1  4  3  3  2  5  4  7  7  4  5  3  5  1  3
##  [438]  2  1  2  1  1  2  5  7  4  3  4  5  4  4  1  5  7  4  1  5  7  5  3
##  [461]  6  1  7  2  7  2  1  5  1  3  7  4  1  7  3  1  7  4  5  4  1  5  3
##  [484]  3  3  3  3  5  2  7  1  1  7  1  3  3  1  1  1  1  1  2  7  4  5  4
##  [507]  5  3  3  2  1  5  3  5  3  7  1  5  5  6  5  5  7  4  7  5  5  1  5
##  [530]  3  7  5  2  5  2  2  3  3  2  2  4  2  1  2  2  5  7  4  3  4  5  4
##  [553]  7  5  5  4  4  5  5  7  6  7  4  5  6  4  3  3  3  1  3  4  3  5  1
##  [576]  5  5  2  3  1  1  3  5  1  4  3  4  1  1  5  6  3  4  2  7  5  1  5
##  [599]  3  7  1  2  6  2  3  5  4  1  5  1  4  4  4  3  4  5  3  3  3  3  6
##  [622]  3  4  4  1  2  3  3  1  3  3  1  5  1  3  7  6  1  4  3  4  1  6  7
##  [645]  3  1  2  1  3  4  1  1  1  4  4  1  1  3  1  3  1  1  4  5  3  7  1
##  [668]  5  1  5  3  2  3  5  3  4  4  3  3  1  3  4  1  2  1  7  1  3  3  2
##  [691]  3  3  4  1  1  7  5  2  2  3  2  5  3  3  3  1  3  2  3  4  7  3  4
##  [714]  3  1  7  6  5  2  5  1  4  4  3  4  3  4  6  1  2  2  7  2  2  2  3
##  [737]  4  5  4  3  5  7  4  3  3  3  3  3  3  3  3  4  5  1  3  2  7  4  4
##  [760]  3  4  3  4  3  1  5  4  3  4  4  3  3  2  1  1  2  3  1  7  3  1  5
##  [783]  5  3  3  4  1  4  2  1  3  3  5  3  3  6  3  3  4  5  3  3  3  1  1
##  [806]  1  5  5  4  4  1  3  3  2  2  4  1  4  2  5  3  4  3  3  1  1  1  2
##  [829]  3  1  4  3  1  1  3  4  4  4  1  2  4  3  4  6  5  2  5  4  1  7  2
##  [852]  6  7  1  1  7  3  4  5  1  1  3  4  7  1  6  1  4  3  3  1  7  4  3
##  [875]  5  5  4  4  4  4  4  1  6  5  7  6  5  7  1  4  3  3  3  1  4  2  3
##  [898]  3  3  7  1  4  3  5  1  2  4  3  7  3  3  7  4  3  1  6  3  4  4  1
##  [921]  1  5  1  3  3  6  1  4  7  4  1  3  4  6  5  3  5  3  3  3  6  3  1
##  [944]  3  1  1  3  3  2  2  3  4  1  4  1  5  5  7  5  3  3  7  3  6  1  3
##  [967]  2  1  2  4  1  1  5  4  5  4  1  6  3  3  1  1  4  6  1  3  4  1  1
##  [990]  4  4  3  3  7  5  6  1  7  7  7  1  5  1  4  3  3  3  1  4  4  5  3
## [1013]  7  3  2  7  2  4  5  4  1  7  1  1  3  5  5  1  4  4  1  3  3  3  1
## [1036]  5  1  7  4  3  1  3  7  3  6  4  1  5  6  4  3  3  7  1  7  5  3  4
## [1059]  3  1  2  2  1  4  1  7  3  3  4  3  4  3  3  3  1  2  1  4  2  3  3
## [1082]  2  7  7  3  4  5  4  7  3  3  5  1  3  3  5  2  1  1  1  4  5  3  1
## [1105]  1  3  4  5  3  1  1  3  1  1  5  1  3  3  1  3  4  4  7  1  1  4  2
## [1128]  3  7  4  4  4  7  4  3  7  3  7  5  3  5  3  3  3  1  1  3  3  1  4
## [1151]  3  6  1  3  2  3  4  1  2  3  4  3  3  7  1  2  3  1  4  2  3  2  1
## [1174]  3  4  3  1  5  1  1  2  5  3  6  3  1  3  7  3  1  5  1  2  1  7  4
## [1197]  3  3  1  7  3  5  7  6  1  7  7  1  5  1  4  3  4  5  1  3  1  3  5
## [1220]  3  4  3  3  3  3  5  5  4  3  3  5  1  5  6  1  1  1  4  2  4  3  4
## [1243]  5  7  4  6  5  4  5  7  7  1  7  3  5  3  4  2  1  1  1  4  5  4  5
## [1266]  7  2  6  1  7  7  2  4  1  5  4  6  7  3  5  7  1  3  4  7  4  5  2
## [1289]  4  3  5  6  1  5  6  3  5  3  7  5  3  7  6  3  5  2  1  7  4  5  3
## [1312]  6  3  1  2  2  3  4  4  5  6  3  7  1  4  4  2  2  1  4  5  1  1  4
## [1335]  7  1  7  4  3  3  3  2  1  5  1  1  7  1  4  3  4  1  1  5  3  1  1
## [1358]  4  3  3  1  5  2  4  3  1  1  3  2  7  1  4  4  1  3  4  2  7  3  3
## [1381]  1  5  3  3  1  1  1  5  4  4  3  1  4  5  5  5  4  1  1  4  5  2  7
## [1404]  5  3  4  4  4  3  7  4  5  6  3  3  3  3  5  7  6  4  4  7  7  7  7
## [1427]  7  7  7  7  5  7  2  6  2  2  4  4  7  7  4  4  7  7  3  5  7  1  6
## [1450]  7  7  5  4  7  2  4  7  4  5  7  4  5  5  7  2  6  3  1  7  4  6  7
## [1473]  7  3  7  6  7  2  2  7  7  4  4  4  5  5  3  3  2  3  4  3  1  3  1
## [1496]  3  3  3  3  3  1  1  7  2  3  2  3  1  6  5  5  1  3  4  1  7  1  1
## [1519]  3  3  7  4  5  2  2  1  5  3  1  1  5  7  3  4  3  3  7  5  3  1  5
## [1542]  5  4  7  5  3  4  4  2  1  1  7  4  4  3  4  5  3  5  7  7  7  1  4
## [1565]  2  4  3  5  6  5  5  4  7  4  3  5  3  6  1  5  4  5  1  6  2  4  4
## [1588]  4  1  1  4  7  7  3  4  1  3  2  3  3  3  2  3  3  5  4  1  3  1  1
## [1611]  4  1  2  1  3  4  7  1  7  4  2  3  4  2  3  1  5  1  7  3  3  3  5
## [1634]  1  3  3  7  2  1  1  3  1  1  1  5  5  3  1  1  3  5  3  5  3  7  3
## [1657]  1  4  6  3  4  1  5  3  4  2  2  1  3  3  5  3  3  3  4  5  3  6  4
## [1680]  6  1  2  5  5  1  5  6  3  5  3  4  4  4  2  3  5  5  5  2  6  7  2
## [1703]  1  3  3  3  1  7  5  1  1  1  6  4  5  1  3  7  4  4  1  5  3  3  2
## [1726]  5  5  4  5  1  3  5  3  6  4  4  1  3  1  7  3  1  7  4  5  1  5  5
## [1749]  3  5  1  5  3  1  7  1  3  3  3  5  7  4  4  7  4  2  4  4  2  4  4
## [1772]  1  4  1  4  3  1  1  4  3  2  3  5  1  3  2  4  5  3  3  3  1  1  5
## [1795]  6  1  3  1  7  3  1  1  4  2  2  4  5  5  4  2  1  3  2  6  7  4  3
## [1818]  2  5  7  7  2  2  7  7  6  3  7  1  1  1  3  5  4  7  4  2  5  3  2
## [1841]  3  1  6  7  7  5  6  7  2  6  3  3  5  3  5  3  4  3  5  3  6  2  7
## [1864]  1  5  4  1  1  4  2  1  3  1  1  4  6  5  1  6  6  5  3  7  4  4  2
## [1887]  3  2  4  7  2  2  2  6  4  7  2  7  1  4  1  5  4  3  4  3  4  5  3
## [1910]  1  3  2  5  4  4  3  4  7  7  7  2  4  5  5  5  4  4  1  3  1  2  4
## [1933]  1  1  4  4  5  7  3  3  7  4  4  3  5  3  3  1  3  1  4  1  3  3  5
## [1956]  5  4  3  3  7  4  2  2  4  3  1  5  7
ess6$educ <- recodeVar(ess6$eisced, src=c(55), tgt= c(NA) )

Checking

ess6$educ
##    [1]  3  3  3  5  3  4  3  7  6  7  7  7  7  2  7  1  3  5  1  7  3  7  3
##   [24]  3  7  6  3  6  6  1  3  3  4  4  7  7  2  3  4  6  7  7  1  5  3  1
##   [47]  1  4  1  4  3  3  2  4  5  3  7  3  7  3  1  3  1  5  4  4  2  3  3
##   [70]  4  2  1  5  6  3  1  7  3  3  4  1  5  3  1  1  4  3  4  1  3  1  2
##   [93]  4  3  3  1  1  3  1  1  1  3  4  7  4  5  3  1  7  2  1  3  3  1  3
##  [116]  1  3  4  1  3  2  6  3  1  1  4  3  5  4  2  3  4  2  7  7  7  5  4
##  [139]  4  7  5  4  4  4  3  1  2  3  3  1  3  4  1  1  2  4  7  7  1  7  1
##  [162]  5  3  3  3  1  5  3  4  2  3  7  7  4  5  3  1  1  1  1  3  3  4  3
##  [185]  7  5  4  3  5  7  4  3  1  3  5  3  2  7  4  1  1  3  2  7  7  1  7
##  [208]  7  4  1  1  5  1  4  5  2  3  1  3  7  3  4  1  5  4  3  7  1  1  2
##  [231]  4  3  1  3  3  3  3  4  4  5  6  3  3  4  7  1  7  7  2  7  7  3  3
##  [254]  3  1  6  4  5  2  1  4  5  3  3  4  1  4  3  5  3  5  1  3  2  4  3
##  [277]  4  6  5  1  4  3  5  6  5  3  7  6  2  2  1  4  4  5  3  1  3  1  3
##  [300]  2  1  5  3  3  6  1  3  3  2  3  1  4  2  4  5  4  4  1  4  1  4  1
##  [323]  1  6  5  4  3  6  4  1  4  1  4  5  3  3  3  7  5  1  2  4  5  3  1
##  [346]  3  4  1  6  3  1  3  4  4  4  1  1  1  1  4  7  1  1  1  5  4  5  3
##  [369]  3  5  5  2  6  7  5  3  4  6  1  1  1  2 NA  3  2  4  2  3  5  3  6
##  [392]  2  3  5  3  1  4  5  5  5  5  2  7  4  3  2  4  4  4  3  3  2  2  4
##  [415]  7  4  3  7  1  1  5  7  1  4  3  3  2  5  4  7  7  4  5  3  5  1  3
##  [438]  2  1  2  1  1  2  5  7  4  3  4  5  4  4  1  5  7  4  1  5  7  5  3
##  [461]  6  1  7  2  7  2  1  5  1  3  7  4  1  7  3  1  7  4  5  4  1  5  3
##  [484]  3  3  3  3  5  2  7  1  1  7  1  3  3  1  1  1  1  1  2  7  4  5  4
##  [507]  5  3  3  2  1  5  3  5  3  7  1  5  5  6  5  5  7  4  7  5  5  1  5
##  [530]  3  7  5  2  5  2  2  3  3  2  2  4  2  1  2  2  5  7  4  3  4  5  4
##  [553]  7  5  5  4  4  5  5  7  6  7  4  5  6  4  3  3  3  1  3  4  3  5  1
##  [576]  5  5  2  3  1  1  3  5  1  4  3  4  1  1  5  6  3  4  2  7  5  1  5
##  [599]  3  7  1  2  6  2  3  5  4  1  5  1  4  4  4  3  4  5  3  3  3  3  6
##  [622]  3  4  4  1  2  3  3  1  3  3  1  5  1  3  7  6  1  4  3  4  1  6  7
##  [645]  3  1  2  1  3  4  1  1  1  4  4  1  1  3  1  3  1  1  4  5  3  7  1
##  [668]  5  1  5  3  2  3  5  3  4  4  3  3  1  3  4  1  2  1  7  1  3  3  2
##  [691]  3  3  4  1  1  7  5  2  2  3  2  5  3  3  3  1  3  2  3  4  7  3  4
##  [714]  3  1  7  6  5  2  5  1  4  4  3  4  3  4  6  1  2  2  7  2  2  2  3
##  [737]  4  5  4  3  5  7  4  3  3  3  3  3  3  3  3  4  5  1  3  2  7  4  4
##  [760]  3  4  3  4  3  1  5  4  3  4  4  3  3  2  1  1  2  3  1  7  3  1  5
##  [783]  5  3  3  4  1  4  2  1  3  3  5  3  3  6  3  3  4  5  3  3  3  1  1
##  [806]  1  5  5  4  4  1  3  3  2  2  4  1  4  2  5  3  4  3  3  1  1  1  2
##  [829]  3  1  4  3  1  1  3  4  4  4  1  2  4  3  4  6  5  2  5  4  1  7  2
##  [852]  6  7  1  1  7  3  4  5  1  1  3  4  7  1  6  1  4  3  3  1  7  4  3
##  [875]  5  5  4  4  4  4  4  1  6  5  7  6  5  7  1  4  3  3  3  1  4  2  3
##  [898]  3  3  7  1  4  3  5  1  2  4  3  7  3  3  7  4  3  1  6  3  4  4  1
##  [921]  1  5  1  3  3  6  1  4  7  4  1  3  4  6  5  3  5  3  3  3  6  3  1
##  [944]  3  1  1  3  3  2  2  3  4  1  4  1  5  5  7  5  3  3  7  3  6  1  3
##  [967]  2  1  2  4  1  1  5  4  5  4  1  6  3  3  1  1  4  6  1  3  4  1  1
##  [990]  4  4  3  3  7  5  6  1  7  7  7  1  5  1  4  3  3  3  1  4  4  5  3
## [1013]  7  3  2  7  2  4  5  4  1  7  1  1  3  5  5  1  4  4  1  3  3  3  1
## [1036]  5  1  7  4  3  1  3  7  3  6  4  1  5  6  4  3  3  7  1  7  5  3  4
## [1059]  3  1  2  2  1  4  1  7  3  3  4  3  4  3  3  3  1  2  1  4  2  3  3
## [1082]  2  7  7  3  4  5  4  7  3  3  5  1  3  3  5  2  1  1  1  4  5  3  1
## [1105]  1  3  4  5  3  1  1  3  1  1  5  1  3  3  1  3  4  4  7  1  1  4  2
## [1128]  3  7  4  4  4  7  4  3  7  3  7  5  3  5  3  3  3  1  1  3  3  1  4
## [1151]  3  6  1  3  2  3  4  1  2  3  4  3  3  7  1  2  3  1  4  2  3  2  1
## [1174]  3  4  3  1  5  1  1  2  5  3  6  3  1  3  7  3  1  5  1  2  1  7  4
## [1197]  3  3  1  7  3  5  7  6  1  7  7  1  5  1  4  3  4  5  1  3  1  3  5
## [1220]  3  4  3  3  3  3  5  5  4  3  3  5  1  5  6  1  1  1  4  2  4  3  4
## [1243]  5  7  4  6  5  4  5  7  7  1  7  3  5  3  4  2  1  1  1  4  5  4  5
## [1266]  7  2  6  1  7  7  2  4  1  5  4  6  7  3  5  7  1  3  4  7  4  5  2
## [1289]  4  3  5  6  1  5  6  3  5  3  7  5  3  7  6  3  5  2  1  7  4  5  3
## [1312]  6  3  1  2  2  3  4  4  5  6  3  7  1  4  4  2  2  1  4  5  1  1  4
## [1335]  7  1  7  4  3  3  3  2  1  5  1  1  7  1  4  3  4  1  1  5  3  1  1
## [1358]  4  3  3  1  5  2  4  3  1  1  3  2  7  1  4  4  1  3  4  2  7  3  3
## [1381]  1  5  3  3  1  1  1  5  4  4  3  1  4  5  5  5  4  1  1  4  5  2  7
## [1404]  5  3  4  4  4  3  7  4  5  6  3  3  3  3  5  7  6  4  4  7  7  7  7
## [1427]  7  7  7  7  5  7  2  6  2  2  4  4  7  7  4  4  7  7  3  5  7  1  6
## [1450]  7  7  5  4  7  2  4  7  4  5  7  4  5  5  7  2  6  3  1  7  4  6  7
## [1473]  7  3  7  6  7  2  2  7  7  4  4  4  5  5  3  3  2  3  4  3  1  3  1
## [1496]  3  3  3  3  3  1  1  7  2  3  2  3  1  6  5  5  1  3  4  1  7  1  1
## [1519]  3  3  7  4  5  2  2  1  5  3  1  1  5  7  3  4  3  3  7  5  3  1  5
## [1542]  5  4  7  5  3  4  4  2  1  1  7  4  4  3  4  5  3  5  7  7  7  1  4
## [1565]  2  4  3  5  6  5  5  4  7  4  3  5  3  6  1  5  4  5  1  6  2  4  4
## [1588]  4  1  1  4  7  7  3  4  1  3  2  3  3  3  2  3  3  5  4  1  3  1  1
## [1611]  4  1  2  1  3  4  7  1  7  4  2  3  4  2  3  1  5  1  7  3  3  3  5
## [1634]  1  3  3  7  2  1  1  3  1  1  1  5  5  3  1  1  3  5  3  5  3  7  3
## [1657]  1  4  6  3  4  1  5  3  4  2  2  1  3  3  5  3  3  3  4  5  3  6  4
## [1680]  6  1  2  5  5  1  5  6  3  5  3  4  4  4  2  3  5  5  5  2  6  7  2
## [1703]  1  3  3  3  1  7  5  1  1  1  6  4  5  1  3  7  4  4  1  5  3  3  2
## [1726]  5  5  4  5  1  3  5  3  6  4  4  1  3  1  7  3  1  7  4  5  1  5  5
## [1749]  3  5  1  5  3  1  7  1  3  3  3  5  7  4  4  7  4  2  4  4  2  4  4
## [1772]  1  4  1  4  3  1  1  4  3  2  3  5  1  3  2  4  5  3  3  3  1  1  5
## [1795]  6  1  3  1  7  3  1  1  4  2  2  4  5  5  4  2  1  3  2  6  7  4  3
## [1818]  2  5  7  7  2  2  7  7  6  3  7  1  1  1  3  5  4  7  4  2  5  3  2
## [1841]  3  1  6  7  7  5  6  7  2  6  3  3  5  3  5  3  4  3  5  3  6  2  7
## [1864]  1  5  4  1  1  4  2  1  3  1  1  4  6  5  1  6  6  5  3  7  4  4  2
## [1887]  3  2  4  7  2  2  2  6  4  7  2  7  1  4  1  5  4  3  4  3  4  5  3
## [1910]  1  3  2  5  4  4  3  4  7  7  7  2  4  5  5  5  4  4  1  3  1  2  4
## [1933]  1  1  4  4  5  7  3  3  7  4  4  3  5  3  3  1  3  1  4  1  3  3  5
## [1956]  5  4  3  3  7  4  2  2  4  3  1  5  7
table(ess6$educ)
## 
##   1   2   3   4   5   6   7 
## 390 174 482 350 263  87 221
is.numeric(ess6$educ)
## [1] TRUE

Making a mosaic plot : levels of education and political positionning

mosaicplot( ess6$p2 ~ ess6$educ, shade=T)

We can move things around to see how it reacts

table(ess6$educ , ess6$p2)
##    
##       0   1   2   3   4   5   6   7   8   9  10
##   1  21   5  15  24  32 120  24  36  44  14  27
##   2  13   7  10   9  12  48  14  14  14  11  11
##   3  34   9  24  49  40 143  19  49  37  13  26
##   4  22   4  28  36  27  96  29  32  37   8  17
##   5  16   7  26  33  36  45  28  24  24   3  13
##   6   4   6  14  11   5  16   6   8   7   1   1
##   7  11  14  21  33  22  48  20  18  21   5   4
mosaicplot( ess6$p2 ~ ess6$educ, shade=T)