嗨,大家好,我在繪製條形圖時出現此錯誤,但我無法擺脫它,我嘗試了qplot和ggplot但仍然是同樣的錯誤。R ggplot2:stat_count()不得與條形圖中的ay美學錯誤一起使用
以下是我的代碼
library(dplyr)
library(ggplot2)
#Investigate data further to build a machine learning model
data_country = data %>%
group_by(country) %>%
summarise(conversion_rate = mean(converted))
#Ist method
qplot(country, conversion_rate, data = data_country,geom = "bar", stat ="identity", fill = country)
#2nd method
ggplot(data_country)+aes(x=country,y = conversion_rate)+geom_bar()
錯誤:
stat_count() must not be used with a y aesthetic
數據在data_country
country conversion_rate
<fctr> <dbl>
1 China 0.001331558
2 Germany 0.062428188
3 UK 0.052612025
4 US 0.037800687
,誤差值在條形圖,而不是在虛線圖來。任何建議將非常有幫助
是的,工作感謝解釋它,我很小新感謝您的幫助 – Uasthana