Your objective is to replicate these figures, created using the Cooperative Congressional Election Study data. These figures are similar to those we completed in the lecture videos.
Hints:
For the x-axis, use the variable “ideo5”.
Make sure you recode the data for the “ideo5” variable to generate the correct names for the x-axis. You will want to consult the codebook.
Use the fill aesthetic to have R fill in the bars. You do not need to set the colors manually.
Use guides() to drop the legend.
Make sure the axis labels and figure title are correct.
##
## Conservative Liberal Moderate Very conservative
## 171 178 253 137
## Very liberal
## 130
Hints:
For the x-axis, use the variable “pew_religimp”.
Make sure you recode the data for the “pew_religimp” variable to generate the correct labels for the x-axis. You will want to consult the codebook.
Rename the column for Ideology to make sure the first letter is upper-case (to make the legend appear correctly).
Use the fill aesthetic to have R fill in the bars. You do not need to set the colors manually.
Make sure the axis labels and figure title are correct.
##
## Not imp. Not too imp. Somewhat imp. Very imp.
## 207 143 221 298
Instructions:
For this visualization, you are creating your own data for practice.
Create a tibble/data frame with three columns: Semester, Student, and Grade.
There should be six semesters and three students (Amanda, Betty, and Carol)
Create grades for the students using the runif() command, with values between 80 and 100. Hint: you’ll need 18 grades total.
The figure should look approximately like this (your vaules will be slightly different):
## student semester grade
## 1 Amanda 1 95
## 2 Betty 1 97
## 3 Carol 1 83
## 4 Amanda 2 83
## 5 Betty 2 82
## 6 Carol 2 94
## 7 Amanda 3 98
## 8 Betty 3 80
## 9 Carol 3 96
## 10 Amanda 4 99
## 11 Betty 4 94
## 12 Carol 4 92
## 13 Amanda 5 89
## 14 Betty 5 96
## 15 Carol 5 97
## 16 Amanda 6 98
## 17 Betty 6 83
## 18 Carol 6 86