public
Last active

Bronfman reference desk statistics broken down by hour and month

  • Download Gist
bronfman-by-hour.R
R
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
> library(ggplot2)
> library(plyr)
> library(lubridate)
> l <- read.csv("~/york/gtd/libstats/libstats.csv")
> l$timestamp <- as.POSIXlt(l$timestamp, format="%m/%d/%Y %r", tz="")
> l$hour <- as.POSIXlt(l$timestamp)$hour
> l$month <- floor_date(l$timestamp, "month")
> recent.bronfman <- subset(l, library.name == "Bronfman" & month >= as.POSIXlt("2012-09-01") & month <= as.POSIXlt("2013-03-31"))
> recent.bronfman.hourly <- count(recent.bronfman, c("hour", "month"))
> recent.bronfman.hourly$month <- as.factor(as.Date(recent.bronfman.hourly$month))
> ggplot(recent.bronfman.hourly, aes(x=hour, y=freq)) + geom_bar(stat="identity") + facet_grid(month ~ .) + xlab("Hour") + ylab("Number") + labs(title="Bronfman reference desk activity, by hour")
> ggsave("bronfman-by-hour.png")
> recent.bronfman.research <- subset(l, library.name == "Bronfman" & month >= as.POSIXlt("2012-09-01") & month <= as.POSIXlt("2013-03-31") & question.type %in% c("4. Strategy-Based", "5. Special"))
> recent.bronfman.research.hourly <- count(recent.bronfman.research, c("hour", "month"))
> recent.bronfman.research.hourly$month <- as.factor(as.Date(recent.bronfman.research.hourly$month))
> ggplot(recent.bronfman.research.hourly, aes(x=hour, y=freq)) + geom_bar(stat="identity") + facet_grid(month ~ .) + xlab("Hour") + ylab("Number") + labs(title="Bronfman reference desk activity, by hour (research questions only)")
> ggsave("bronfman-by-hour-research-only.png")
>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.