ggplot中的[错误:美学长度必须为1或与数据相同]出现问题

时间:2019-06-10 08:39:26

标签: r ggplot2

经过几次尝试解决后,我仍然遇到这种麻烦。

第一:

ggplot(dat, aes(x = method, y = age)) + 
      stat_boxplot(geom = "errorbar", width = 0.5) + geom_boxplot()

R说:

  

需要TRUE / FALSE时缺少值

我尝试一下:

ggplot(dat, aes(x = na.omit(method), y = na.omit(age))) + 
    stat_boxplot(geom = "errorbar", width = 0.5) + geom_boxplot()

R说:

  

错误:美学必须为长度1或与数据相同   (6253):x,y

请帮助我。

0 个答案:

没有答案