R ggplot2: stat_count() must not be used with a y aesthetic error in Bar graph

前端 未结 4 1355
[愿得一人]
[愿得一人] 2020-12-02 06:34

I am getting this error while plotting a bar graph and I am not able to get rid of it, I have tried both qplot and ggplot but still the same error.

Following is my c

4条回答
  •  悲哀的现实
    2020-12-02 07:05

    when you want to use your data existing in your data frame as y value, you must add stat = "identity" in mapping parameter. Function geom_bar have default y value. For example,

    ggplot(data_country)+
      geom_bar(mapping = aes(x = country, y = conversion_rate), stat = "identity")
    

提交回复
热议问题