Coding Goals

  1. To get used to customizing the output more, making it look more aesthetically pleasing design-wise and a bit more dynamic to look at rather than just the plain html default text.

  2. To watch and comprehend the data visualization videos and understand how to input my code from another file.

  3. To understand that error messages are normal and very frequent, I should not be getting frustrated by them.

How I went about achieving my goals

Overall how I went about achieving them is watching each video step by step and doing the best that I could to follow it. If there are any problems down the line I will ask in slack or wait until I’m able to ask at the QnA for further support!

I was able to get and input some of the codeword examples that was used in the data visualization console. However this is simply a repeat of the same codeword with regards to library(tidyverse) and am not sure yet of how to input specific data or graphs that I have made

This has been rectified and been adressed in challenges

Working with Data Input and ggplot

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()

Just learned of the input with ggplot with relation to functions and draws up a blank plot

Figured out how to input data and then make a scatter plot.

# draw the plot that I want 
picture <- ggplot(data = mpg) + 
  geom_point(
    mapping = aes(
      x = displ, 
      y = hwy 
    )
  )

# print the ggplot object 
print(picture)

Aesthetic Mappings

The information bearing components of the plot is what is known as aesthetics, these aesthetics play a crucial part in how we are able to understand sets of data much easier

One such quality for aesthetics is colour and the following is my attempt to integrate colour

picture <- ggplot(data = mpg) + 
  geom_point(
    mapping = aes(
      x = displ, 
      y = hwy, 
      colour = cyl
    )
  )

print(picture)

The next step was integrating another fixed colour

picture <- ggplot(data = mpg) + 
  geom_point(
    mapping = aes(
      x = displ, 
      y = hwy, 
    ),
    colour = "gold",
    size = 3
  )

print(picture)

Layered Plot

picture <- ggplot(data = mpg) + 
  geom_point(
    mapping = aes(
      x = displ, 
      y = hwy, 
    ),
    colour = "gold",
    size = 3
  ) + 
  geom_smooth(
    mapping = aes(
      x = displ, 
      y = hwy, 
    ), 
    colour = "orange"
  ) + 
  geom_rug(
    mapping = aes(
      x = displ,
      y = hwy 
    )
   )

print(picture)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'

Tidying Code

  • Trying to get rid of the redundancies of the lines before. I had an issue with this which is also further expanded in my challenges.]

Dino Plot

# Speaking of which, we need some data... 
dino <- read_csv("data_dino.csv")
## Parsed with column specification:
## cols(
##   horizontal = col_double(),
##   vertical = col_double()
## )
print(dino)
## # A tibble: 142 x 2
##    horizontal vertical
##         <dbl>    <dbl>
##  1       55.4     97.2
##  2       51.5     96.0
##  3       46.2     94.5
##  4       42.8     91.4
##  5       40.8     88.3
##  6       38.7     84.9
##  7       35.6     79.9
##  8       33.1     77.6
##  9       29.0     74.5
## 10       26.2     71.4
## # … with 132 more rows
# Create a new "picture"...
picture <- ggplot(data = dino) + 
  geom_point(mapping = aes(x = horizontal, y = vertical))
  colour = "gold"

# ... and plot it
plot(picture)

Working with Boxplots

#load data
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()
## )
#construct plot 
picture <- ggplot(data = forensic) + 
  geom_boxplot (mapping = aes(
    x = band,
    y = est,
    fill = band))+
  facet_wrap(facets = vars(handwriting_expert))

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

This is the furthest I could go as editing the text was extremely difficult to do with this setting and I’m not sure how to get rid of it - once again will clarify in the QNA

Successes

  • I know it may seem silly to record every single bit of progress made, however I’d like this to serve that I was able to successfully do even the small steps made since I was so frustrated by my lack of progress earlier.

  • was able to follow most of the processes step by step however and the silver lining is that I guess I now understand the frustration of what its like not to be able to do what you want to do and that it’s okay for it to happen. I just need to be patient and take my time with it

Challenges

  • Transferring the output from the Rscript into the Rmarkdown document I struggled with for the longest time as I thought if it was all under the same workspace, just copying and pasting the input for both the code and the graph would just come out. However it didn’t work this way and instead I needed to make sure I have the data input library on both documents. However to make it much more simply from now on, I will be working on it solely from Rmarkdown and treating each line of code with a new chunk. Thankfully I was able to get help from a friend who has done the course in the previous term.

  • For some reason whenever I type and try to either tab or open up a new space, it deletes over the concurrent words so makes it really difficult to tidy up my previous code. Not sure as to why this is occuring, I will be sure to ask in the QNA session.

Looking Back

Overall I’m still proud that I was able to complete a majority of the tasks for Week 2, however there is still alot of work I have to reclarify, relearn and do better with. One of my larger aims I have still yet to complete when having looked at other people’s learning logs is having fun with it and exploring other options. This week was harder but because of that it was more rewarding to keep at it, and over the course of the next week I will work even harder and never give up :)