美学必须是长度1或与数据(10)相同:x,填充r闪亮

时间:2021-01-29 16:10:44

In R below code is working but inside r shiny it is giving error.

在R下面的代码是有效的,但是在R闪亮的内部它是错误的。

code :

代码:

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

data :

数据:

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

error :

错误:

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

Thanks...

谢谢……

1 个解决方案

#1


1  

You've to add 'Print' in your code.

您必须在代码中添加'Print'。

For example:

例如:

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

print(Graph)

#1


1  

You've to add 'Print' in your code.

您必须在代码中添加'Print'。

For example:

例如:

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

print(Graph)