Home Comments Thread
New Thread

3 Comments

giscus-bot giscus-bot 2022-12-16 17:16:57
Guest *fan* @ 2009-10-11 08:06:54 originally posted:

Wow, amazing~

@thinkfan

giscus-bot giscus-bot 2022-12-16 17:16:58
Guest *Kevin Wright* @ 2009-10-27 01:12:58 originally posted:

I don't use ggplot2, so maybe I'm wrong, but it does not appear that ggplot2 is respecting the bin width of 1 hour. Here is an equal-bin-width version using lattice:

library(lattice)
histogram(~hour, data = subset(hour.data, author == "ripley"),
          type="count",
          breaks=0:24-.1,
          scales=list(x=list(at=c(0,6,12,18,24)))
          )

Your graph does a nice job of answering the question. Ripley usually quits working by 12:00 and almost always by 1:00 AM. He almost never starts before 5:00 AM.

Shifting the 'window' from 0-24 hours to 4-28 hours provides a different (more natural?) perspective on Ripley's 'day':

hour2 <- subset(hour.data, author == "ripley")
hour2$hour <- ifelse(hour2$hour < 4, hour2$hour + 24, hour2$hour)
histogram(~hour, data = hour2,
          type="count",
          breaks=4:30-.1,
          scales=list(x=list(at=c(0,6,12,18,24)))
          )

Kevin Wright

yihui yihui 2022-12-16 17:16:59

Thanks for your reply, Kevin. Yes, you second suggestion is a more natural representation of the working hours -- a day starts from the morning instead of the mid-night (for most people). For the histogram, actually I'm not a regular user of ggplot2, and I didn't check stat_bin() carefully, but after your reminding, I found a weird behavior of it which confused me: qplot(1:10)+stat_bin(binwidth=1) will produce a histogram which is not flat... :shock:

Originally posted on 2009-10-28 02:26:24

giscus-bot giscus-bot 2022-12-16 17:16:58
Guest *Thomas Levine* @ 2010-06-17 00:20:02 originally posted:

I think Ripley's high commit count is misleading when you're comparing whether he sleeps to whether other R core members sleep. You should change the y axes from raw count to percentage of total count. Once you do this, I think the other authors' commits will look more spread-out.

yihui yihui 2022-12-16 17:17:00

Thanks! That will be a reasonable enhancement :)

Originally posted on 2010-07-02 11:07:49

Sign in to join the discussion

Sign in with GitHub