stat_count() must not be used with a y aesthetic

目录

stat_count() must not be used with a y aesthetic

#仿真数据

#问题

解决:

完整错误:


#仿真数据

data_country <- data.frame(country = c("China", "Germany", "UK", "US"), conversion_rate = c(0.001331558,0.062428188, 0.052612025, 0.037800687))

#问题

library(dplyr)library(ggplot2)#Investigate data further to build a machine learning modeldata_country = data %>%group_by(country) %>%summarise(conversion_rate = mean(converted))#Ist methodqplot(country, conversion_rate, data = data_country,geom = "bar", stat ="identity", fill =   country)#2nd methodggplot(data_country)+aes(x=country,y = conversion_rate)+geom_bar()

解决:

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")

完整错误:

> library(dplyr)
> library(ggplot2)

> #Investigate data further to build a machine learning model
> data_country = data %>%
+     group_by(country) %>%
+     summarise(conversion_rate = mean(converted))
Error in UseMethod("group_by") : 
  no applicable method for 'group_by' applied to an object of class "function"
> #Ist method
> qplot(country, conversion_rate, data = data_country,geom = "bar", stat ="identity", fill =   country)
Error: stat_count() can only have an x or y aesthetic.
Run `rlang::last_error()` to see where the error occurred.
In addition: Warning message:
`stat` is deprecated 
> #2nd method
> ggplot(data_country)+aes(x=country,y = conversion_rate)+geom_bar()
Error: stat_count() can only have an x or y aesthetic.
Run `rlang::last_error()` to see where the error occurred.

参考:R

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

stat_count() must not be used with a y aesthetic相关推荐

  1. ggplot报错 stat_count() can only have an x or y aesthetic

    在使用ggplot画柱状图的时候,发生了报错:tat_count() can only have an x or y aesthetic. #画图用的矩阵 > b3name mean lcl95 ...

  2. Error: stat_count() can only have an x or y aesthetic Run `rlang::last_error()` to see where the err

    Error: stat_count() can only have an x or y aesthetic Run `rlang::last_error()` to see where the err ...

  3. Datacamp_Introduction to the Tidyverse

    1_Data wrangling gapminder:An excerpt of the data available at Gapminder.org. For each of 142 countr ...

  4. linux 内核配置简介

    Gentoo Linux Gentoo内核(gentoo-sources)特有的选项 Gentoo Linux support CONFIG_GENTOO_LINUX 选"Y"后, ...

  5. java知识精华总结

    Java 知识--精华总结 一. -java 概述与基础知识-6 1.何为编程?-6 2.Java 语言概述,历史.特点- 6 3.什么是跨平台性?原理是什么?JVM- 7 4.Jre 和 Jdk 的 ...

  6. Dots + interval stats and geoms

    Anatomy of geom_dotsinterval() The dotsinterval family of geoms and stats is a sub-family of slabint ...

  7. R语言绘制分类变量柱状图

    背景 Excel中无法实现分组区分颜色. 右边的图是我手动点击各个柱形修改分组颜色的. 请问如何在R和Excel中分别实现右图? 更新后完整解决方案: # 数据载入 ----------------- ...

  8. LeetCode简单题之找到最近的有相同 X 或 Y 坐标的点

    题目 给你两个整数 x 和 y ,表示你在一个笛卡尔坐标系下的 (x, y) 处.同时,在同一个坐标系下给你一个数组 points ,其中 points[i] = [ai, bi] 表示在 (ai, ...

  9. floquet端口必须沿z轴设置_金秀友佳FMH-630加工中心伸缩Y轴钢板防护罩批发价格...

    金秀友佳FMH-630加工中心伸缩Y轴钢板防护罩批发价格 钢板防护罩装置使护罩同动且平行(避免了一般剪力式防护罩仍有蛇行的缺点),在高速时可以更平稳.没有振动产生.讯耐高温防护罩可有效地保护丝杠.光杠 ...

最新文章

  1. 谷歌最强 NLP 模型 BERT 解读
  2. 【算法】双指针算法 ( 有效回文串 II )
  3. mybatis association表关联与rowbounds共同使用时的异常及其解决方案
  4. jQuery学习笔记1--表格展开关系
  5. 怎么设置qq信息同步服务器,QQ输入法如何设置网络同步
  6. 查看运行时间_怎样查看自己电脑系统的版本信息?
  7. 查询数据库中所有表的行数(sqlserver 2000)
  8. goldengate mysql_使用GoldenGate实现MySQL到Oracle的数据实时同步
  9. 概率期望题(期望 DP)做题记录
  10. EC20模组使用MQTT库对接EMQX,基于STM32F407
  11. 强烈推荐:给去美国的新生说几句(转载),超实用
  12. Windows Phone 用WebBrowser加载HTML页面
  13. 拼多多狂砸百亿补贴的iphone是真的吗?
  14. [BZOJ1779][Usaco2010 Hol]Cowwar 奶牛战争(最大流)
  15. android 添加子view,如何在Android中向ImageView添加子视图
  16. 材料分享主题一:如何向上级汇报部门/组织架构
  17. slice,splice,substring,split
  18. Linux 系统vim练习简单的 shell script
  19. Hutool如何给Excel按行设置背景颜色
  20. Python内存驻留机制

热门文章

  1. 主键策略UUID升级
  2. 52 JavaScript中的正则表达式
  3. Linux命令行与shell脚本编程大全(第3版)
  4. hbase 默认目录_HBase 配置示例
  5. python开发网页有优势吗_Python用来做Web开发的优势有哪些
  6. 基于激光雷达点云的3D检测方法汇总(LiDAR only)
  7. 多视图立体匹配论文分享CasMVSNet
  8. 一文详解毫米波雷达基本技术与应用
  9. 视频|深度相机与应用
  10. 工坊专访|2020智博会,AR、VR、智能驾驶是亮点