Hello, I have been trying all these options above but I keep getting more errors.. I feel like it could be because I do not integrate it correctly into the coding..
That is my code at the moment, any further help of how I can integrate it in the code exactly with no errors would be appreciated.. Thank you and sorry in advance.
final_plot_data <- structure(list(Condition = c("Low-Lyrical", "Lyrical"), Q18_1_mean = c(5.375,
4.47826086956522), Q18_2_mean = c(5.15625, 4.43478260869565),
Q18_3_mean = c(4.59375, 3.8695652173913), Q18_4_mean = c(5.1875,
4.21739130434783), Q18_5_mean = c(5.46875, 4.65217391304348
), Q18_6_mean = c(4.78125, 3.95652173913043), Q18_7_mean = c(4.78125,
4.26086956521739), Q18_10_mean = c(4.90625,
4.30434782608696), Q18_1_sd = c(0.975506485486286, 1.53355099560676
), Q18_2_sd = c(1.16700263979578, 1.53226175536575), Q18_3_sd = c(1.07341405894253,
1.57550418556574), Q18_4_sd = c(0.895778630487862, 1.59420888728064
), Q18_5_sd = c(1.10670609788542, 1.46500684615757), Q18_6_sd = c(1.15659051219661,
1.49174275352279), Q18_7_sd = c(1.15659051219661, 1.684620035507
), Q18_10_sd = c(0.856074122506811, 1.42811963493946
)), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA,
-2L))
final_plot_data %>%
dplyr::select(c(
"Condition", "Q18_1_mean", "Q18_2_mean", "Q18_3_mean", "Q18_4_mean", "Q18_5_mean", "Q18_6_mean", "Q18_7_mean", "Q18_10_mean","Q18_1_sd", "Q18_2_sd", "Q18_3_sd", "Q18_4_sd", "Q18_5_sd", "Q18_6_sd", "Q18_7_sd", "Q18_10_sd"
)) %>%
tidyr::pivot_longer(
cols = -Condition,
names_to = c("variable", ".value"),
names_pattern = "(.*)_(.*)"
) %>%
ggplot(aes(x = variable, y = mean, fill = Condition)) +
geom_col(position = "dodge") +
geom_errorbar(
aes(ymin = mean - sd, ymax = mean + sd),
width = 0.2,
position = position_dodge(.9),
) +
ggplot2::scale_fill_grey() +
labs(x = "Relevance Scale Questions (1-7 & 10)", y = "Mean Relevance Rating") +
theme(text=element_text(family="Times New Roman", size=12)) +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank()) +
theme_classic()