当前位置:首页 » 《随便一记》 » 正文

Error: stat_count() can only have an x or y aesthetic Run `rlang::last_error()` to see where the err_data+scenario+science+insight

10 人参与  2022年05月17日 09:44  分类 : 《随便一记》  评论

点击全文阅读


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

目录

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

#仿真数据

#问题

#解决


#仿真数据

install.packages("ggplot2")             
# Install ggplot2 package
library("ggplot2")                      
# Load ggplot2 package
data <- data.frame(x = LETTERS[1:5],    
# Example data
                   y = 5:1)
data

#问题

ggplot(data, aes(x, y)) +               
# Draw barchart with ggplot2 package
  geom_bar()

> ggplot(data, aes(x, y)) +               
+     # Draw barchart with ggplot2 package
+     geom_bar()
Error: stat_count() can only have an x or y aesthetic.
Run `rlang::last_error()` to see where the error occurred.

#解决

ggplot(data, aes(x, y)) +               
# Draw barchart with ggplot2 package
  geom_bar(stat = "identity")

参考:R 

参考:R ggplot2 Error: stat_count() must not be used with a y aesthetic (Example)
 


点击全文阅读


本文链接:http://zhangshiyu.com/post/40277.html

仿真  参考  解决  
<< 上一篇 下一篇 >>

  • 评论(0)
  • 赞助本站

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

关于我们 | 我要投稿 | 免责申明

Copyright © 2020-2022 ZhangShiYu.com Rights Reserved.豫ICP备2022013469号-1