abort("stat_bin() can only have an x or y aesthetic.")の対処法

 

R言語で以下のようなエラーが出た際の対処法

abort("stat_bin() can only have an x or y aesthetic.")

 

以下のサイトを見ると良いが、消されたら困るので、一応ここにも記す。

https://stackoverflow.com/questions/39679057/r-ggplot2-stat-count-must-not-be-used-with-a-y-aesthetic-error-in-bar-graph

 

data_country <- data.frame(country = c("China", "Germany", "UK", "US"), 
            conversion_rate = c(0.001331558,0.062428188, 0.052612025, 0.037800687))
ggplot(data_country, aes(x=country,y = conversion_rate)) +geom_bar(stat = "identity")

グラフが出力される