Statistics

Spring 2013
course
navigation
    1. Making a PDF with 2 summary graphs
pdf("reported_incidents_summary.pdf")
ggplot(incidentbyReportedTypeb, aes(x=Reported.Incident.Type,y=Number)) + geom_bar(stat="identity") +
ggtitle("Incidents by Reported Type, Fall 2010 to March 2013") + scale_y_continuous(name="Number of incidents") + scale_x_discrete(name="") + coord_flip()

ggplot(incidentbySummaryTypeb, aes(x=Summary.Incident.Type,y=Number)) + geom_bar(stat="identity") +
ggtitle("Incidents by broad Category, Fall 2010 to March 2013") + scale_y_continuous(name="Number of incidents") + scale_x_discrete(name="") + coord_flip()

dev.off()
  1.  
  1. Turning dates from spreadsheet
    1. into Dates in R

meltedIncidentData$Incident.Date <- as.Date(meltedIncidentData$Incident.Date, format='%m/%d/%Y')
    1. Preliminary histograms
pdf("preliminary_incidents_over_time.pdf")
ggplot(meltedIncidentData, aes(x=meltedIncidentData$Incident.Date)) + ggtitle("Binwidth 1") + geom_histogram(binwidth=1)
ggplot(meltedIncidentData, aes(x=meltedIncidentData$Incident.Date)) + ggtitle("Binwidth 7") + geom_histogram(binwidth=7)
ggplot(meltedIncidentData, aes(x=meltedIncidentData$Incident.Date)) + ggtitle("Binwidth 14") + geom_histogram(binwidth=14)
dev.off()