我非常喜欢使用sciplot
实验数据,因为我不必手动计算误差线。过去,我用它对两个因子变量进行分组,例如:
plot1<-bargraph.CI(
df$factor1, #categorical factor for the x-axis
df$y, #numerical DV for the y-axis
df$factor2 #grouping factor
)
但是,我现在需要对三个因子变量进行分组。文档表明这sciplot
是不可能的sciplot.
所以,现在到了必要的时间来问......我到底该怎么做ggplot2
?具体来说,是否有一种简洁的方法来生成包含超过 3 个因子变量的误差线图?我在网上四处寻找,在寻找一个优雅的解决方案时总是不满意。
下面的示例数据:
factor1 factor2 factor3 y
More expensive Least important Blue 1
Less expensive Most important Blue 0
Same cost Least important Red 1
More expensive Least important Red 0
Less expensive Most important Red 1
Same cost Least important Blue 1
More expensive Least important Red 1
Less expensive Least important Blue 0
Same cost Most important Red 1