Goals
This week my goal was to get the percentages reported in the graph for each variable. I also wanted to create the bar graph using these percentages. Both of these goals were met, as discussed below.
Successes
The coding expertise in our team is one of our greatest successes! I am very proud of what we have been able to reproduce from creating, checking and adding to each others codes.
This week I successfully found the percentages for all of the variables but one. After many error messages when trying to filter for answers on a particular scale (E.g extremely agree) I was able to get the right output. Whilst I had many errors and difficulties creating the graph from these percentages, Bart (a group member) was able to complete this goal with the found percentages!
Challenges
Initially to find the percentages I just used the “mutate(percentage =)” code however I was getting numerous difference percentages for each variable, when the graph only displays one for each. After investigating the output we realised the researchers only reported ‘extreme’ answers at one end of the scale. E.g In image below for the variable q8 have immunity, the percentages reported in the graph were for answers of extreme agreeance corresponding only to values “[5]” - therefore 12% and 2%.
We were then able to filter for only this percentage. This filtering process was needed for many of the variables. I was able to get the percentages for the graph in my code and check they were all correct … except for the variable going_out_total variable. I wasn’t sure how to filter this variable for the responses that were greater than (>) a certain number. Here is the error message I was receiving.
With help from the Jenny in the Q and A session we were able to get the desired percentage for this variable and our goal of getting all of the percentages was complete!
We then put this code for each of the percentages into a code for the graph and created our bar graph! I was able to create the chart below getting the same values as Bart (group member) who’s chart added correct labels of variables and axis, and the correct order of the variables.
I used the following code: graph <- graph_values_2 %>% ggplot(aes(fill = Ever_covid, x= vars, y=Percentage)) + geom_bar(position = position_dodge(width = 0.8),stat = “identity”, width = 0.6 ) + scale_y_continuous(limits = c(0,60), breaks = c(0,10,20,30,40,50,60)) + theme_bw() + theme(axis.text.x = element_text(angle = 55, vjust = 1, hjust = 1), legend.position = “bottom”, legend.title = element_blank(), axis.title.x = element_blank(), axis.title.y = element_text(vjust = 4))
Side Note The “help” menu next to packages was very helpful in giving examples and explanations of how to use certain functions for getting percentages, filtering, creating bar graphs and MORE!
Side Note 2 The tibbles and graph in my learning log this week are screenshots because for some reason (I think because of packages not being installed) my code works on the R document I am using for the assignment, but not the document I am writing my Learning log in… This is a problem I couldnt solve in time and will try to solve for next week - I just wanted to show you guys my progress regardless!
Where to next
Next I will assist group members working on the tables. Then I will move onto writing out what we found, what we learnt about reproducibility and suggestions for the researchers - for the presentation.
Most importantly next week is Flexibility Week - time to take a small break, revise the previous weeks and get a head start on the busy weeks ahead. 🎉