Hello everyone! I was excited to learn more stuff about R, albeit I was a bit nervous considering all the stuff we learned was quite foreign to me. However, Dani teaches everything really well and I was able to follow along just fine.
My goals were to get through the dino exercise without referencing my notes, and to play around with data visualisation with new data.
I tried watching the videos in one sitting, but I was only able to watch up to Video 6 before I had to do something else. What this meant was I did not do the dino exercise until the day after.
This was a real test of my memory to see if I remembered anything from the previous day.
What I found was that I was able to remember everything rather well, and things came intuitively to me. I only consulted my notes once because I forgot what geom_point was.
library(tidyverse)
dino <- read_csv("data_dino.csv")
print(dino)
picture <- ggplot(data = dino) +
geom_point(mapping = aes(x = horizontal, y = vertical))
plot(picture)
And I was able to create the dino (yay!).
I was initially going to use the forensic data to create a box plot with new variables, but I kept receiving an error that I did not know how to fix.
However, I tried the next day and I ended up getting it to work.
This is what I did:
picture <- ggplot(data = data_forensic) +
geom_boxplot(
mapping = aes(x = band, y = est, fill = band)) +
facet_wrap(vars(us)) +
theme_light(
) +
scale_x_discrete(
name = NULL,
labels = NULL
) +
scale_y_continuous(
name = "ESTIMATE"
) +
ggtitle(
label = "US vs non-US Forensic Scientists",
subtitle = "Source: Martire et al."
) +
scale_fill_viridis_d(
alpha = .6,
name = NULL
)
plot(picture)
And this is what my box plot looked like:
As aforementioned, R kept giving me an error that I could not fix with the variables I was using.
Then, I tried using the exact code that Dani used in the videos, but I still kept receiving the error.
I ended up restarting R studio and it ended up working! I am still not sure what caused the error though.
I was also unable to insert the R chunks properly because R kept saying that object “dino_data” and “forensic_data” were not found, so I kept getting errors. For that same reason, I could not get the output so I had to post pictures of my dino and boxplot instead.
I would like to understand why I am getting those errors, and get better at finding the solutions to those errors. I have been using Google, but sometimes it isn’t very helpful.
I would also like to be more confident about not depending on my notes for coding.