r - R中的参数图
问题描述
我正在尝试使用ggplot2
UNvotes 数据制作一个绘图。我正在尝试参数化 Rmarkdown 中的绘图,但出现以下错误:
Error: Problem with `summarise()` input `perc_yes`. x non-numeric argument to binary operator i Input `perc_yes` is `sum(vote == "yes")/n`. i The error occurred in group 1: yr = 1991.
代码:
single_country %>%
inner_join(un_roll_calls %>% select(rcid, date), by = "rcid") %>%
mutate(yr = year(date)) %>%
group_by(yr) %>%
summarize(perc_yes = sum(vote == "yes") / n) %>%
ggplot(aes(x = yr, y = perc_yes)) +
geom_point() +
geom_line() +
labs(title = plot_title)
不确定它是否缺少一些重新编码问题。
解决方案
推荐阅读
- python - 最大递归深度超过了写一个简单的函数
- c++ - 如何定义这个 C++ 约束?
- javascript - 三个或更多字母的字母组合
- sql - 获取 SQL 预留和可用性时出错
- spring - Spring Cloud Config 服务器是否与 GitOps 兼容?
- java - 如何在数据库中正确实现验证注册?
- javascript - jQuery 产品显示页面不显示详细信息
- elasticsearch - ElasticSearch:如何从索引中删除所有具有特定值的特定字段的文档
- terraform - 以条件方式对动态块内容进行 Terraform
- c# - AndroidJavaException: java.lang.NoSuchMethodError: no non-static method with name='getStatusCode' signature='()I'