2016-07-22 59 views
0

在R下面的代码正在工作,但里面的r闪亮它给出了错误。美学必须是长度1或与数据(10)相同:x,填写r有光泽

代码:

ggplot(df_score) + 
     geom_bar(aes(x=emotion, y=..count.., fill=hashTag),position = "dodge") 

数据:

score hashTag 
1 Neutral hash1 
2 Neutral hash1 
3 Positive hash1 
4 Neutral hash1 
5 Neutral hash1 
6 Negative hash2 

错误:

Aesthetics must be either length 1 or the same as the data (10): x, fill 

谢谢...

+1

除非我在这里失去了一些东西,你的代码应该是'AES(X = score..',因为没有所谓的'emotion'在您的样本数据帧的变量另外,因为'ggplot2'代码工作正常,而且你在代码中闪亮的部分存在问题,所以你应该在你的问题中包含这个问题。 – Sumedh

+0

谢谢..我犯了一个非常糟糕的错误。 – anindya

回答

1

您已经添加 '打印' 在你的代码。

例如:

Graph<-ggplot(df_score) + 
     geom_bar(aes(x=emotion, y=..count.., fill=hashTag),position = "dodge") 

print(Graph) 
相关问题