2012-09-30 65 views
-6

我目前正在使用Twitters API創建個人推文的直方圖。我在用戶發送推文時創建了一個日期列表(在for循環中)。日期的R:直方圖顯示密度而不是頻率

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(日期,場所= 7)它示出了在y軸上,而不是頻率密度。

有關如何顯示頻率而不是密度的任何想法?

+0

請給出一個可重複的示例,以便人們可以真正看到您的問題(另請參閱http://stackoverflow.com/q/5963269)。 – rinni

回答

7

?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)