I am having an issue with my error bars. they look gigantic in R, but look much more accurate in Excel. Example in R:
Code
Graph = subset(dat,dat$Condition != "z" & dat$Environment != "a")
Graph %>%
group_by(Gate = fct_inorder(Gate), Sound, Block) %>%
summarize(Accuracy = mean(Correct),
sd = sd(Correct)) %>%
ggplot(aes(x = Gate, y = Accuracy, color = Sound, group = Sound)) +
geom_line() +
geom_errorbar(aes(ymin = Accuracy - sd, ymax = Accuracy + sd,)) +
scale_y_continuous(labels = scales::percent)+
facet_wrap(~Block) +
theme_minimal()
Reproducible sample
set.seed(42)
n <- 100
dat <- data.frame(Participant=1:n,
Environment=rep(LETTERS[1:2], n/2),
Condition=rep(LETTERS[25:26], n/2),
Gate= sample(1:5, n, replace=TRUE),
Block= sample(1:2,n, replace=TRUE),
Sound=rep(LETTERS[3:4], n/2),
Correct=sample(0:1, n, replace=TRUE)
)
