cheese <- read_csv("cheese.csv")
## Rows: 10 Columns: 5
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): cheese
## dbl (4): catherine, frederic, alan, lin
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
cheese <- cheese%>%
rename(lynn = lin)
rater_colors <- c(
lynn = "#440154FF",
catherine = "#20A386FF",
frederic = "#FDE725FF",
alan = "#238A8DFF"
)
cheese_long <- cheese %>%
pivot_longer(cols = c(lynn, catherine, frederic, alan),
names_to = "rater",
values_to = "grade")
rating_individual <- function(who){
cheese %>%
rename(name_of_cheese = cheese) %>%
arrange(!!sym(who)) %>%
ggplot(aes(x = reorder(name_of_cheese, !!sym(who)), y = !!sym(who))) +
geom_col(fill = rater_colors[[who]], color = "white") + # Ensure rater_colors is correctly indexed
labs(
title = paste0(who, "'s ratings"),
x = "Cheese",
y = "Rating"
) +
theme_bw() +
coord_flip()
}
col <- colorRampPalette(c("#FDE725FF","white","#39558CFF"))
corrplot(cor(cheese[2:5]),
method="color", col=col(200),
type="upper", order="hclust",
addCoef.col = "black", # Ajout du coefficient de corrélation
tl.col="black", tl.srt=0, #Rotation des étiquettes de textes
# Combiner avec le niveau de significativité
sig.level = 0.01, insig = "blank",
# Cacher les coefficients de corrélation sur la diagonale
diag=FALSE
)

ggplot(cheese_long, aes(x = rater, y = grade, fill = rater)) +
geom_boxplot() +
scale_fill_manual(values = rater_colors) +
labs(
title = "Kindness plot",
x = "Rater",
y = "Rating"
) +
theme_bw()

rating_individual("catherine")

rating_individual("lynn")

rating_individual("alan")

rating_individual("frederic")

cheese_long %>%
ggplot(aes(x = grade)) +
geom_bar(fill = "#2D718EFF") +
theme_bw() +
labs(title = "Ratings given",
x = "Rating", y = "Amount of times given")

cheese_long %>%
ggplot(aes(x = grade, fill = rater)) +
geom_bar(position = "dodge") +
scale_fill_manual(values = rater_colors) +
theme_bw() +
labs(
title = "Ratings given by Rater",
x = "Rating",
y = "Amount of times given"
)

cheese %>%
rename(name_of_cheese = cheese) %>%
mutate(total_grade = catherine + lynn + alan + frederic) %>%
arrange(total_grade) %>%
ggplot(aes(x = reorder(name_of_cheese, total_grade), y = total_grade)) +
geom_col(fill = "#DCE318FF", color = "white") +
labs(
title = "Results!",
x = "Cheese",
y = "Total Rating"
) +
theme_bw()+
coord_flip()
