0

I know it seems stupid question to ask but I'm really struggling with this one:

I have a list of events with recorded StartDate values. How do I plot density of events by time? So I want to have a plot where on X axis will be time and on Y axis there will be number of event occured at this time period.

#   StartTime                  Wait time
162 2011-05-12 09:59:54        0:01:07
163 2011-05-12 10:00:24        0:05:57
164 2011-05-12 10:02:20        0:05:03
165 2011-05-12 10:03:49        0:33:35
166 2011-05-12 10:06:00        0:10:51

UPDATE: hist(dat$StartDate, breaks = "hours") works fine for me. However I need to make density line aroud this hist. I've no clue how to do that since I have NOT numeric values.

  • 1
    Hi and welcome to stackoverflow! Please update your question with a [**minimal, reproducible example**](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610). Also read some of the guidelines for Stackoverflow, [**here**](http://stackoverflow.com/help/on-topic) and [**here**](http://stackoverflow.com/about) and [**here**](http://meta.stackexchange.com/questions/156810/stack-overflow-question-checklist): you should show us the code you have tried and explain why it didn't produce the desired result. Cheers. – Henrik Nov 29 '13 at 12:34

1 Answers1

0

without example data I would guess something like

hist(dat$StartDate, breaks = "days")

EDIT

for your data maybe

hist(dat$StartTime, breaks = "mins")
user1317221_G
  • 15,087
  • 3
  • 52
  • 78
  • Thx that helped! Did't know about breaks thing, heh Is it any chance I could draw a density plow though, not histogram? Seems plot(density(x)) wants to have numeric values only.. – user3031053 Nov 29 '13 at 12:49