For both the ‘Hello data’ and ‘Data wrangling’ lectures, I watched the lectures and completed the relevant exercises prescribed by Professor Navarro. I learnt new functions that allow me to do things like:
Group values under mean, SD and n
Load the data and rename the variables
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.4 v purrr 0.3.4
## v tibble 3.1.2 v dplyr 1.0.6
## v tidyr 1.1.3 v stringr 1.4.0
## v readr 1.4.0 v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
swow <- read_tsv(file = "data_swow.csv.zip")
## ! Multiple files in zip: reading ''swow.csv''
##
## -- Column specification --------------------------------------------------------
## cols(
## cue = col_character(),
## response = col_character(),
## R1 = col_double(),
## N = col_double(),
## R1.Strength = col_double()
## )
swow <- swow %>% mutate(id = 1:n())
swow <- swow %>%
rename(n_response = R1,
n_total = N,
strength = R1.Strength)
Filter and arrange the data so that idiosyncratic responses are removed and the strength of the backwards associations for ‘man’ are in descending order.
man_bck <- swow %>%
filter(response == "man", n_response > 1) %>%
arrange(desc(strength)) %>%
select(-n_response,-n_total)
Plot a column graph with a flipped x and y axes in wide form for the forward associations by gender
This week’s coding lectures were very long but I was able to finish all the lectures without too much of an issue. The functions taught were also relatively straightforward and I didn’t have much issue understanding the pipe function, filter function, bind function etc.. Most of the exercises were moderately easy. The first Q and A session was also super useful especially with regards to installing packages and installing RStudio was very simple.
That being said… when I went back to code the functions I learnt by only referring to my notes, I encountered a lot of error messages. For example, in exercise 6, R didn’t read the code:
Some I managed to resolve. For example, the error(above) occurred because I didn’t run all previous codes. However, other I am still trying to figure out.
I also had lots of issues getting R to import and read the data_reasoning.csv file from “Hello data!”. Fortunately, I did find a solution on Google and got help from Slack. In the end, I had to manually set the entire path to the relevant file. However, I’m finding that this does not solve all the issues so hopefully the Q and A sessions can help clear things up.
Another big challenge for me was to clean up the graph for backwards associations by gender in Exercise 7:
Into this:
For this exercise, modifying the code to plot a graph for backwards associations was not too difficult however, figuring out how to filter the variables to make the graph look like the one in the slides was tremendously difficult. It was only through consulting Slack that I found the solution.
I hope to learn more about importing data in the Q and A sessions. I also look forward to actually applying all the functions I have learnt in reproducing data from my group’s selected article. However, for now I don’t really feel confident in using all the functions that have been taught so I aim to practice and revise the functions with different data sets. For personal interest, I also hope to find more aesthetic themes that I could use and play around with.