我的代码现在看起来像这样:
library(ggplot2)
ggplot (y=mean, data=a)+geom_bar(stat="identity")+geom_errorbar(aes(ymin=mean - sd, ymax=mean + sd,width=0.15))
我会收到以下错误:
平均值 - SD中的错误:非数字参数到二进制运算符
这些是我加载的库:
if(!require(psych)){install.packages("psych")}
if(!require(FSA)){install.packages("FSA")}
if(!require(Rmisc)){install.packages("Rmisc")}
if(!require(ggplot2)){install.packages("ggplot2")}
if(!require(car)){install.packages("car")}
if(!require(multcompView)){install.packages("multcompView")}
if(!require(lsmeans)){install.packages("lsmeans")}
if(!require(rcompanion)){install.packages("rcompanion")}
编辑:
structure(list(morning.time = c(39.28, 42.32, 45.56, 43.47, 45.1,
42.44, 49.2, 45.99, 52.48, 49.16, 49.63, 47.4, 48.14, 47.89,
52.91, 51.56, 49.28, 53.62), morning.pushups = c(32L, 34L, 37L,
38L, 42L, 45L, 51L, 51L, 52L, 54L, 53L, 52L, 53L, 54L, 57L, 56L,
54L, 59L), evening.time = c(37.75, 39.58, 42.88, 38.45, 40.72,
37.12, 39.89, 45.31, 39.73, 42.69, 42.47, 45.47, 43.65, 47.78,
46.97, 47.75, 46.72, 42.12), evening.pushups = c(30L, 32L, 38L,
34L, 39L, 37L, 35L, 42L, 39L, 47L, 48L, 48L, 48L, 54L, 52L, 47L,
49L, 47L)), .Names = c("morning.time", "morning.pushups", "evening.time",
"evening.pushups"), class = "data.frame", row.names = c(NA, -18L
))
您没有指定您的数据来自何处,您所指的是"含义",以及put aes()aroudn x和y,很可能您会HAEV将您的数据称为数据$均值或数据$ SD,我建议使用一个称为" UCL"one_answers" LCL"的列,因此您不在代码中进行计算。
`ggplot (data=YOURDATAFRAMEGOESHERE,aes(y=mean,x=XVARGOESHERE))+
geom_bar(stat="identity")+
geom_errorbar(aes(ymin=mean - sd,
ymax=mean + sd,width=0.15))`
因此,每当您看到"某种东西替代二进制操作员"时,这只是意味着识别您的变量的程序,或者您忘记了Geoms之间的" "