为什么我用这个简单的 ggplot 图找不到对象?
我有一个非常简单的数据集,我正在尝试制作一个非常简单的图表,但我收到一个未找到对象的错误,我无法确定原因。这是 head(techissues) 的输出
Event.Start.Date Were.you.able.to.see..hear.and.follow.the.presentation...
1 2011-09-29 Yes
11 2011-09-19 Yes
17 2011-09-19 Yes
20 2011-08-30 No
26 2011-09-29 Yes
27 2011-09-29 Yes
这是情节代码:
qplot(factor(techissues$Event.Start.Date), fill=as.character(techissues$Were.you.able.to.see..hear.and.follow.the.presentation...))< /code>
我期待一个条形图,其中 x 上有日期字符串,还有一个堆叠条形图,显示每个日期的“是”和“否”的数量。我可以在其他数据集上准确地绘制这种类型的图,但我不明白这个有什么不同。
错误是 eval(expr, envir, enclos) 中的错误:找不到对象“techissues”
summary(techissues)
Event.Start.Date Were.you.able.to.see..hear.and.follow.the.presentation...
Length:188 Length:188
Class :character Class :character
Mode :character Mode :character
就是这样。这是怎么回事?
I have a very simple dataset and I'm trying to make a very simple graph, but I get an object not found error and I can't determine why. Here's the output of head(techissues)
Event.Start.Date Were.you.able.to.see..hear.and.follow.the.presentation...
1 2011-09-29 Yes
11 2011-09-19 Yes
17 2011-09-19 Yes
20 2011-08-30 No
26 2011-09-29 Yes
27 2011-09-29 Yes
Here's the plot code:qplot(factor(techissues$Event.Start.Date), fill=as.character(techissues$Were.you.able.to.see..hear.and.follow.the.presentation...))
I'm expecting a bar graph with the date strings along the x and a stacked bar showing the number of Yes and No for each date. I can make exactly this type plot on other datasets, and I don't understand how this one is different.
The error is Error in eval(expr, envir, enclos) : object 'techissues' not found
summary(techissues)
Event.Start.Date Were.you.able.to.see..hear.and.follow.the.presentation...
Length:188 Length:188
Class :character Class :character
Mode :character Mode :character
That's it. What's going on here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ggplot
和qplot
期望您提供带有data=
参数的data.frame
,并指定美学映射在此框架内,即您通常不应该使用$
:虽然
它似乎在某些简单的情况下工作,但它主要是一个不受欢迎的功能。
ggplot
andqplot
expect that you supply adata.frame
with thedata=
argument, and specify the aesthetic mapping within this frame, i.e. you should typically never use$
:not
though it may seem to work in some simple situations, it is mostly an undesired feature.