library(tidyverse)
library(ggplot2)
emotions <- c("Joy", "Sadness", "Anger", "Disgust", "Fear", "Anxiety", "Envy",
"Embarrassment", "Boredom", "Love", "Prettiness")
percentages <- c(90, 25, 5, 70, 15, 20, 5, 15, 30, 100, 100)
emotion_dta <- data.frame(emotions, percentages)
emotion_dta$emotions <- factor(emotion_dta$emotions, levels = emotions)
custom_colors <- c("Joy" = "yellow1", "Sadness" = "slateblue2",
"Anger" = "tomato2", "Disgust" = "green3",
"Fear" = "mediumpurple2","Anxiety" = "sienna1",
"Envy" = "seagreen3","Embarassment" = "plum",
"Boredom" = "slategray2", "Love" = "violetred",
"Prettiness" = "hotpink")
ggplot(data = emotion_dta, aes(x = emotions, y = percentages, fill = emotions)) +
geom_bar(stat = "identity", width = 0.5) +
scale_fill_manual(values = custom_colors) +
labs(title = "Percentage of Occurrence of Robin's Emotions",
subtitle = "According to Jhil", caption = "Source: Jhil Patel") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1),
axis.title.x = element_blank(),
axis.title.y = element_blank()) +
guides(fill = guide_legend(title = "Emotion"))Exploring the Incidence of Robin’s Emotions
A Data Visualization
Abstract
The purpose of this data exploration is to employ visualization tools via the ggplot2 package in order to graph Robin’s emotions, as inspired by the Pixar film franchise, “Inside Out.”
Data Presentation
Discussion of Findings
As per the above bar plot, it is evident that Robin’s most frequently occurring emotions are “Joy,” “Love,” and “Prettiness.” Given my high level of expertise in the field, I can confidently assert these findings to be true and objective. Emotions such as “Anger,” “Envy,” and “Embarrassment” are not as frequently occurring to Robin – a valuable quality to have. “Sadness,” “Disgust,” and “Boredom” have moderate levels of occurrence.
Shapiro Normality Test
library(kableExtra)
library(dplyr)
emotion_dta <- data.frame(emotions, percentages)
shapiro_tst <- shapiro.test(emotion_dta$percentages)
shapiro_results <- data.frame(Statistic = shapiro_tst$statistic,
P_Value = shapiro_tst$p.value)
shapiro_results |>
kable(col.names = c("Shapiro-Wilk Statistic", "P-Value"),
caption = "Shapiro-Wilk Test Results") |>
kable_styling(bootstrap_options = c("striped", "hover", "condensed"))| Shapiro-Wilk Statistic | P-Value | |
|---|---|---|
| W | 0.8146493 | 0.0146654 |
A Shapiro-Wilk Statistic of 0.814 suggests that the data does not fit a normal distribution: Robin’s love, joy, and prettiness is above-average. As the p-value = 0.014 is below the significance level of 0.05, we reject the null hypothesis. This suggests that Robin’s love, joy, and prettiness highly exceeds the mean.