I'm a French girl studying R for the first time. I wanted to learn how to compare distributions of two variables.
I have a dataset with results of a survey from a country that has two parties: a social democratic party and a fiscal conservative party. This survey measures party ID, attitudes on social policies and a few other things. List of variables (A to G) and their coding, in the order they appear in the Excel file:
• A. Support for Social Democratic - Fiscal Conservative Party (coded 1 Strong Soc-Dem, 2 Soc-Dem, 3 In the middle, 4 Fisc-Con, 5 Strong Fisc-Con) Attitudes towards social policies are recorded in variables B to E (all coded 1 Strongly Agree, 2 Agree, 3 Neither, 4 Disagree, 5 Strongly Disagree):
• B. Government should tax the rich and help the poor
• C. Government should increase pensions
• D. Government should take care of the homeless
• E. Government should take care of the unemployed
• F. Age (in years)
• G. Number of hours spent listening to music each week (in hours)
Here is a sample
A B C D E F G 1 1 2 1 1 1 59 17 2 3 3 3 3 3 40 16 3 2 3 2 2 2 45 7 4 4 3 4 4 4 83 6 5 1 1 1 1 1 46 11
I need to compare the distributions of variable B and D using appropriate measures. Compared to taking care of the homeless, what do respondents believe regarding the way government should tax the rich ?
I tried the following function to compare both B : "Government should tax the rich and help the poor" and D "Government should take care of the homeless" :
boxplot(data$B ~ data$D)
Which gives me, with the true data, something like :
But I don't know neither how to to read it nor what respondents believe regarding the way government should tax the rich. I'm not even sure it was the right plot function to use.