我先使用ggplot创建一个错误栏,我计算了se . 数据名称是“读取”

> p = read %>%   filter(bookshelf == "read") %>%   group_by(month_read)
   > %>%   summarize(mean = mean(pages),sd=sd(pages), n=length(month_read),
   > se=sd(pages)/sqrt(n))
> attach(p)

结果就是这些 .

month_read    mean         sd         n      se
        (fctr)      (dbl)       (dbl)     (int)   (dbl)
1        April    294.9500    84.34171     20    18.85938
2       August    372.2857    195.90988    14    52.35912
3     December    472.5294    215.32769    17    52.22464
4     February    319.0000    87.74763     18    20.68232
5      January    305.0400    109.31090    25    21.86218
6         July    381.3333    190.55646    18    44.91459
7         June    333.9167    133.19320    24    27.18795
8        March    319.0625    138.68596    16    34.67149
9          May    351.2273    136.12212    22    29.02133
10    November    302.1667    67.57465     12    19.50712
11     October    388.4444    148.11323     9    49.37108
12   September    388.6250    125.57859     8    44.39874

然后我试着做一个ggplot

> ggplot(read, aes(x=month_read, y=pages), fill=pages) +   
> geom_bar(position="dodge", stat="identity") +  
> geom_errorbar(aes(ymax=mean+se, ymin=mean-se),
>                 width=.2,
>                 position=position_dodge(0.9))

但是,我收到了这个错误

错误:美学必须是长度为1或与dataProblems相同的长度:均值se,mean - se

================================================== ======================

我应该纠正什么?

谢谢 .