[R] Histogram over times (without dates)

Greg Snow greg.snow at ihc.com
Thu Mar 24 18:16:46 CET 2005

Have you looked at the "CircStats" and "circular"? They have some plotting functions that may be of help to you. 

Greg Snow, Ph.D.
Statistical Data Center
greg.snow at ihc.com
(801) 408-8111

>>> "Dubravko Dolic" <Dubravko.Dolic at komdat.com> 03/24/05 09:38AM >>>
Dear Group,

Having a character vector like this one:


[1] "03:38:55" "07:42:38" "08:04:27" "08:17:13" "08:41:14" "08:46:58"

[7] "08:47:11" "08:53:51" "08:57:51" "08:58:56"


I try to do a histogram over times of a day. All I want to know, if my solution is proper or if there is another way to go.


There is no Information about the day on which this time occurred. it is unimportant as I want to know at what times on a day a costumer buys anything (times are collected from logfiles).

The values span 24 hours (e.g. 00:00:00 to 23:59:59)


I converted the characters to chron objects (library(chron)) and then to numeric vectors:


ordertm.num <- as.numeric(chron(times = ecom$Ordertime))



Then I put the numeric values to hist(), printed the hist without axes=F and constructed my own axis.


The result is satisfactory. But as there are so many possibilities with times on R (namely using the POSIX classes) I want to be shure if there is no "standard" approach to handle such time related problems (note that the date is irrelevant to my problem).


have a goof Easter holiday


All the best


Dubravko Dolic








Dubravko Dolic <http://www.dolic.de/pagedd.html> 

-- Statistik --

Tel:      +49 (0)89-55 27 44 - 4630

Fax:     +49 (0)89-55 27 44 - 2463

Email: dubravko.dolic at komdat.com      


Komdat GmbH

Nymphenburger Straße 86 / TH 3

80636 München


Partners for your success 

www.komdat.com <outbind://96-000000009676DC1A07BA5142BC1A44984B6E7FAC070052D1AC81378E9342947189B04176014700000017F023000052D1AC81378E9342947189B04176014700000017F7DA0000/www.komdat.com> 



	[[alternative HTML version deleted]]

R-help at stat.math.ethz.ch mailing list
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

More information about the R-help mailing list