I am trying to include 3 graphs where the x variables refers to different emotions (coded as 0,1). However, ggplot doesn't allow me to have multiple x values. How can I change this? Or is there a base R version of this I can use?
cdjz_plot <- ggplot(dat2, aes(x = as.factor(normal_positive), y = behavior_ch)) +
geom_bar(stat = "summary", fun = "mean") +
scale_x_discrete(labels = c("Negative", "Normal")) +
stat_summary(geom = "errorbar", fun.data = mean_se, width = 0.2) +
stat_summary(aes(label = sprintf("%0.2f", round(..y.., digits = 2))),
geom = "text", fun.data = mean_se, position = position_nudge(y = -0.2)
) +
ylim(0, 1) +
labs(x = "CDJZ-EP", y = "Probability of behavior change")
Here's how "normal positive" is coded:
dat2$normal_positive <- 0
dat2$normal_positive[
(dat2$feelings_cbp_calm == 1 | dat2$feelings_cbp_relaxed == 1 |
dat2$feelings_cbp_happy == 1 | dat2$feelings_cbp_relief == 1 |
dat2$feelings_cbp_normal == 1) & (dat2$feelings_cbp_angry == 0 &
dat2$feelings_cbp_anxious == 0 & dat2$feelings_cbp_nervous == 0 &
dat2$feelings_cbp_stressed == 0)
] <- 1
I tried changing the x variable but it doesnt work