0
#   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

r <- hist(may12waitingTime$StartTime, breaks = "hours")
plot(density(r$counts))

Help me out, I want to have those plots on one graph. I've tried lines(), points() and other advices from StackOverflow, but i'm still stumbled with this. Thx in advance!

  • You are having problems because density gives you just that -- density. Its values are usually way below 0, which is why nothing is showing on your graph. In would be willing to bet that there's a line very near the x axis. – Roman Luštrik Dec 02 '13 at 08:20

1 Answers1

0

You can do it this way:

x <- rnorm(100) # example data

hist(x, freq = FALSE) # you need to specify freq = FALSE
lines(density(x))

enter image description here

Sven Hohenstein
  • 80,497
  • 17
  • 145
  • 168