2016-07-22 93 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) 
相關問題