r - 计数为 R 的直方图
问题描述
我正在尝试创建我的数据的直方图。我的数据框看起来像这样
x counts
4 78
5 45
... ...
其中 x 是我想要绘制的变量,counts 是观察次数。如果我做 hist(x) 情节将是误导,因为我没有考虑计数。我也试过:
hist(do.call("c", (mapply(rep, df$x, df$count))))
不幸的是,这不起作用,因为结果向量会太大
sum(df$ount)
[1] 7943571126
我还有其他方法可以尝试吗?
谢谢
解决方案
推荐阅读
- elasticsearch - Elasticsearch 同义词搜索 synonym.txt 格式
- javascript - 有没有办法在javascript中自定义window.print()中的保存按钮?
- selenium - 无法为活动元素找到正确的 xpath
- python - 对于最大和子列表,是否有任何时间复杂度为 O(n^3) 的算法?
- java - 当用户滚动到 RecyclerView 的底部时,使用 ScrollListener 从 Firebase Realtime DB 中提取数据的问题
- vue.js - 如何使用自定义过滤器功能过滤 b 表行?
- gitlab - 找不到 gitlab“admin/runners”页面来注册共享跑步者
- java - 使用java从本地主机创建远程hdfs目录
- css - 更改为 Bootrap 4,我的导航栏现在看起来是蓝色的,并且没有一个下拉菜单与之前的位置对齐
- node.js - 出现错误:连接 ECONNREFUSED 127.0.0.1:3306