My Coding Goals:

  1. To gain an understanding of how to utilise data visualisation as a tool that presents information.

  2. To work through the exercises (dino, emoji translation etcetera.). I watched the youtube playlist for the data visualisation module early in the week and resolved to begin working through the exercises earlier, so that I would have more time to problem-solve. I felt that this was ideal, especially since I anticipated that it would be difficult.

  3. To practice rubber duck decoding, I think it was called? One of the important aspects of open science is not only having your data and your materials there, but having them clearly explained so that it can be followed by anyone with access to it. I used a voice recorder and narrated my actions as I worked through the exercises, which helped to track everything that I did.

  • It may have also captured a breakdown or two, but all in the name of science!

How did I do?

Exercise 5

I started with exercise 5, as it seemed like a fun and relatively less daunting way to start off this module. I was able to create this really cool dinosaur, which I’ve named Bernie.

Handwriting Features Exercise

# Load the packages needed

library(tidyverse)
## ── Attaching packages ───────────────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.2.1     ✓ purrr   0.3.3
## ✓ tibble  2.1.3     ✓ dplyr   0.8.4
## ✓ tidyr   1.0.2     ✓ stringr 1.4.0
## ✓ readr   1.3.1     ✓ forcats 0.4.0
## ── Conflicts ──────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
# Load the data needed

forensic <- read_csv("data_forensic.csv")
## Parsed with column specification:
## cols(
##   participant = col_double(),
##   handwriting_expert = col_character(),
##   us = col_character(),
##   condition = col_character(),
##   age = col_double(),
##   forensic_scientist = col_character(),
##   forensic_specialty = col_character(),
##   handwriting_reports = col_double(),
##   confidence = col_double(),
##   familiarity = col_double(),
##   feature = col_character(),
##   est = col_double(),
##   true = col_double(),
##   band = col_character()
## )
# Draw the plot that I want

picture <- ggplot(forensic) +
  geom_boxplot(
    mapping = aes(
      x = band,
      y = est,
      fill = band
    )
) +

facet_wrap(vars(handwriting_expert)) +
  scale_x_discrete(
    name = NULL ,
    labels = NULL
  ) +
 
   scale_y_continuous(
    name = "Estimate"
  ) +
  
  ggtitle(
    label = "Estimates of handwriting feature frequencies",
    subtitle = "Source: Martire, Growns & Navarro, 2018"
  ) +
  scale_fill_viridis_d(
    alpha = .7 ,
    name = NULL
  )

# draw plot
plot(picture)
## Warning: Removed 4 rows containing non-finite values (stat_boxplot).

I also wanted to practice adding an embed plot:

## Warning: Removed 4 rows containing non-finite values (stat_boxplot).

Challenges:

  • In terms of the dinosaur exercise: I kept encountering an error message which said ‘object: picture not found’ and ‘could not find function ggplot’. The issue, I later found, was that I had been clicking ‘run’, not ‘source’.

  • In terms of the forensic data exercise:

    • I struggled with using a facet wrap to group the data by the variable “handwriting expert”. It kept saying that there was an error in the source, and my initial thought was maybe I had made a mistake with the brackets. I finally fixed the issue by seperating each line of code and adding the various elements (ie. colour, facets, removing the labels) one at a time. I’m still not sure what exactly was causing the problem but my guess is that perhaps there were issues in spacing?? Not sure exactly.

    • I also struggled with removing the labels, as I encountered an error message saying that there was an error in source, highlighting the name= null and the label. I used google to fix the issue and found that my problem was that I had said ‘name = null’ but forgotten the space and comma that followed after. When I corrected this, the issue resolved.

  • In general: I found that a lot of my errors were caused by silly mistakes such as forgetting spaces or commas. It’s very easy to overlook when you’re trying to write lines and lines of code, but I definitely have more of an awareness now. One of the first things I now do when I encounter an error is go back and examine a) the spacing, b) the commas, or c) the brackets. That usually tends to be the key cause of errors.

Strengths:

  • I was really impressed with myself this week. One of the things I mentioned last week was wanting to approach coding with a positive mindset and make it a fun thing (or realistically, as fun as it can be). I had that as a key goal in my mind and I carried that with me as I worked through the exercises. I definitely had moments where I had no clue what the issue was and I was frustrated but I managed to problem-solve and actually fix the issues, instead of just giving up. As soppy as this is, I’m real proud of me!! :)

Next Steps:

  • To work on the next coding module and consolidate my understanding of the basics we’ve been taught. I’m guessing that the upcoming reproducibility project will be difficult, so I’m trying to get more comfortable googling (is that a word?) solutions!