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.
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.
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):
## # A tibble: 18 × 3
## Semester Student Grade
## <chr> <chr> <dbl>
## 1 1 Amanda 90.6
## 2 1 Betty 92.6
## 3 1 Carol 92.3
## 4 2 Amanda 84.2
## 5 2 Betty 92.2
## 6 2 Carol 85.0
## 7 3 Amanda 91.2
## 8 3 Betty 97.2
## 9 3 Carol 91.2
## 10 4 Amanda 85.6
## 11 4 Betty 95.7
## 12 4 Carol 81.3
## 13 5 Amanda 98.8
## 14 5 Betty 88.3
## 15 5 Carol 86.1
## 16 6 Amanda 96.4
## 17 6 Betty 87.9
## 18 6 Carol 85.5