当我对数据进行子集化时,qplot给出错误“美学必须是长度一,或与dataProblems相同”

时间:2014-10-29 10:46:45

标签: r plot ggplot2 subset

我试图在我上线的航空公司数据集中绘制原点和时间延迟。当我使用整个数据集时,它工作正常。

qplot(origin,delay,data = mydata,stat = 'summary', fun.y = 'mean')

我收到错误

  

Aesthetics must either be length one, or the same length as the dataProblems:origin

当我在设置数据后尝试此操作时。这是我使用的代码。

qplot(origin,delay,data = subset(mydata,state=='TX'),stat = 'summary', fun.y = 'mean')

我也尝试使用基本绘图系统。它可以与整个数据一起使用

with(mydata,plot(origin,delay))

但在子集化时失败

with(subset(mydata,state=='TX'),plot(origin,delay))
Error in model.frame.default(formula = y ~ x) :variable lengths differ (found for 'x')

0 个答案:

没有答案