R !!!errorbar !平均±標準誤差 !標準誤差の計算 se = sd/sqrt(項目数) !!先に平均とSEを計算しておく {{pre ```{r} library(dplyr) sugi_iwa_mean_sd_se <- sugi_iwa.dat %>% group_by(cond, time) %>% summarise(mean=mean(score), sd=sd(score), se=sd/sqrt(20)) ``` ```{r} g <- ggplot(sugi_iwa_se) g <- g + aes(x=time, y=mean, color=cond) g <- g + geom_line() g <- g + geom_errorbar(aes(ymin=mean-se, ymax=mean+se)) plot(g) ``` }} !!ggplotの式の中で計算する {{pre g <- ggplot(sugi_iwa.dat) g <- g + aes(x=time, y= score, color=cond) g <- g + geom_point() g <- g + geom_jitter(width = 0.05) g <- g + facet_grid(rows = vars(cond)) g <- g + stat_summary(fun = mean, fun.min = function(x) mean(x) - sd(x), fun.max = function(x) mean(x) + sd(x), geom = "pointrange", color="black", size=0.7) g <- g + stat_summary(fun = mean, geom = "line", width=2) plot(g) }}