【问题标题】:Equivalent of histc function in R?等效于 R 中的 histc 函数?
【发布时间】:2015-05-25 22:13:32
【问题描述】:

R 中是否有与 matlab 函数 histc 等效的函数? 矢量和箱是数字。

[ countInBin, binIndexOfVectorElement ] = histc( vector, bins )

地点:

bins = min(vector) : increment : max( vector )

length( binIndexOfVectorElement ) = length( vector )

【问题讨论】:

  • 你能解释一下这与?hist 有何不同吗??hist 返回一个列表,其中包含带有断点、中点和每个 bin 计数的元素?
  • 当然。在 matlab 中, histc 函数还提供了向量的第 j 个元素所在的 bin 的索引。它返回每个 bin 的向量值的计数,就像 hist$counts 一样。 histc 函数允许指定 bin 边界(hist$breaks 的输出)。
  • 所以也许你正在寻找?findInterval
  • 找到就行了。

标签: r histogram indices bins


【解决方案1】:

pracma 包的功能 histc 与 matlab 对应的功能类似

【讨论】:

    猜你喜欢
    • 2020-03-18
    • 2012-02-21
    • 1970-01-01
    • 2016-03-27
    • 1970-01-01
    • 2021-01-14
    • 1970-01-01
    • 2021-04-13
    • 2018-02-20
    相关资源
    最近更新 更多