October 16, 2016

Snow Removal Data 2015-2016

This data was collected by a small Snow Plow company located in Barrie, ON Canada

Frequency of Day Spent Plowing

The graph represents number of days spent plowing driveways from November 15th, 2015 to April 15th, 2016.

Frequency of Time Spent Plowing

The graph represents the frequency of time spent plowing each driveway in minutes during the winter season.

Code Used

> # Load Libraries
> library(dplyr)
> library(plyr)
> library(data.table)
> library(plotly)
> 
> # Load Snow Data into a data frame from CSV file
> snowData<- data.frame(
+   read.csv("snowjob.csv", header = TRUE, na.strings = "NA")
+   )
> 
> #Remove empty values in the data frame
> snowData<- na.omit(snowData)

Calculate Time Worked Data

> 
> #Get frequency of time worked by count the TimeWorkedMin field
> t <- data.frame(count(snowData$TimeWorkedMin))
> 
> #Sample Data
> head(t,8)
     x freq
1 0:02    1
2 0:03   10
3 0:04    5
4 0:05   20
5 0:06   20
6 0:07   19
7 0:08   26
8 0:09   11

Calculate the Days Worked

> #Get the frequency of Days Worked by counting the field Recorded
> d <- data.frame(count(snowData$Recorded))
> 
> #Convert the Factor to a Date to make sorting easier
> d$day <- as.Date(d$x, format = "%m/%d/%Y")
> 
> #drop the x column
> d <- d[, !names(d) %in% "x"]
> #Arrange the data by Day
> d <-arrange(d,day)
> 
> #Sample Data
> head(d,3)
  freq        day
1   17 2015-12-29
2    9 2015-12-31
3   12 2016-01-03

About the Author