怎样才能“安排”?命令用于为 R 中的直方图生成一组 bin

发布于 2024-11-18 10:39:21 字数 388 浏览 5 评论 0原文

当我尝试通过定义一组 bin 来在 R 中绘制直方图时,我收到此错误“some 'x' not counted; some 'x' not counted;”也许“中断”不跨越“x”的范围。 我正在关注网站“http://msenux.redwoods.edu/math/R/hist.php”上的信息,其中指出“使用 arange 命令生成这组垃圾箱”。我尝试在互联网上搜索如何为我的数据集生成合适范围的垃圾箱,但徒劳无功。

谁能告诉我它是如何完成的?或者是否还有其他方法。 我尝试将垃圾箱设置为

bins=seq(0,3,by=0.2)

并将直方图绘制为

hist(log10(a),col=4,breaks=bins)

While I try to plot histogram in R by defining a set of bins I get this error 'some 'x' not counted; maybe 'breaks' do not span range of 'x''.
I am following the information on the website 'http://msenux.redwoods.edu/math/R/hist.php' which states 'Use the arange command to produce this set of bins'. I tried to search in the internet about how to produce suitable range of bins for my data set but in vain.

Could anyone tell me how its done? or if there is any other way.
I have tried to set the bins as

bins=seq(0,3,by=0.2)

and plot histogram as

hist(log10(a),col=4,breaks=bins)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青朷 2024-11-25 10:39:21

我怀疑某些 log10(a) 超出了 [0,3] 范围。在这种情况下,您可以简单地执行类似

bins<-seq(min(log10(a)), max(log10(a))+1, by=0.2)

这样的操作,以确保所有值都在容器内。

I suspect that some log10(a) is outside the range [0,3]. In that case, you can simply do something like

bins<-seq(min(log10(a)), max(log10(a))+1, by=0.2)

This ensures that all the values are within the bins.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文