Created
October 31, 2016 01:05
-
-
Save yisongtao/9c06f0afe99a17a84c7e9f34cf285f17 to your computer and use it in GitHub Desktop.
Plot3 code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
noise_complaints$`Created Date` <- as.POSIXct(strptime(noise_complaints$`Created Date`, "%m/%d/%Y %I:%M:%S %p")) | |
noise_complaints$Weekday <- weekdays(noise_complaints$`Created Date`) | |
noise_complaints$Hour <- format(noise_complaints$`Created Date`, "%H") | |
noise_complaints$Weekday <- factor(noise_complaints$Weekday, | |
levels = c("Monday", "Tuesday", "Wednesday", | |
"Thursday", "Friday", "Saturday", "Sunday")) | |
noise_sum1 <- noise_complaints %>% group_by(Weekday, Hour) %>% | |
summarise(Count = n()) | |
p1 <- ggplot(noise_sum1) + | |
geom_freqpoly(aes(x= as.numeric(Hour), | |
y = Count, color = Weekday), stat = "identity") + | |
xlab("Hour") + ylab("Number of Complaints") + | |
ggtitle("Number of Noise Complaints vs Hour") + | |
theme_few() + scale_x_continuous(breaks = c(0:23)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment