R:直方图显示密度而不是频率



我目前正在使用Twitters API创建个人推文的直方图。我创建了一个用户发推文的日期列表(在 for 循环中)。

dates=c(dates,obtweets[[i]]$getCreated());

日期示例:

> dates[1:3]
[1] "2012-09-09 16:01:18 EDT" "2012-09-29 17:26:12 EDT"
[3] "2012-09-28 17:53:34 EDT"

但是,当我生成 hist(日期,breaks=7) 时,它在 y 轴上显示密度而不是频率。

知道如何显示频率而不是密度吗?

来自?hist文档:

freq: logical; if ‘TRUE’, the histogram graphic is a representation
      of frequencies, the ‘counts’ component of the result; if
      ‘FALSE’, probability densities, component ‘density’, are
      plotted (so that the histogram has a total area of one).
      Defaults to ‘TRUE’ _if and only if_ ‘breaks’ are equidistant
      (and ‘probability’ is not specified).

所以你应该尝试hist(dates, breaks = 7, freq = TRUE).

最新更新