使用R中的mpg数据,我可以用以下代码绘制“displ”的箱线图:
boxplot(mpg$displ)
但是当我尝试使用ggplot制作这个简单的箱线图时,
ggplot(data = mpg, aes(displ)) + geom_boxplot()
我收到了这个错误信息:
Error in seq.default(from = best$lmin, to = best$lmax, by = best$lstep) : 'from' must be of length 1
In addition: Warning messages:
1: Continuous x aesthetic -- did you forget aes(group=...)?
2: In is.na(data$y) : is.na() applied to non-(list or vector) of type 'NULL'