Go to content ALT+c

Quantitative Applications for Data Analysis  (Winter 2017) (Old site; new site is at https://scinet.courses)
Registration is closed

Friday May 31, 2024 - 15:44

5.3 Assignment 3

Due date: Friday, February 3rd at midnight (Friday night)

Consider the Comma Separated Value file located at tinyurl.com/UTSC-Ass3.  This dataset contains about 1/3 of the data pertaining to parking tickets issued in the city of Toronto in 2015.  Details about the data can be found here.

  


 

0) Be sure to use version control ("git"), as you develop your script.  Do "git add ....,  git commit" repeatedly as you add to your script.  You will hand in the output of "git log" for your assignment repository as part of the assignment. 

 


 

Write an R script, called myTickets.R, which performs the following:

1) Reads the above dataset, from the internet, and puts it into a data frame.  Recall that data frames were covered in lecture 4.  Note that "downloads from the internet" does not mean "loads the data from a locally-saved copy".  You should create a locally-saved copy for your testing and development, but the script which you submit must download the data directly from the link given above. Also note that this is a rather large file, and will take a few moments to download.

2) Calculates and prints the number of tickets issued for parking in a front yard.

3) Calculates and prints the average fine issued in April.

The substr function might be useful here.  It may also be necessary to cast your dates into strings, using the as.character function.

4) Calculates and prints the state or province which generated the second-highest number of tickets (the highest is Ontario, obviously).

For this question, depending on your strategy, functions which might be helpful include sort and rle, or table (which is a data type we haven't discussed). Note that it may be helpful to cast your provinces to strings before handling them, depending on your approach, using the as.character function. 

Your script should output something like this, when run from the bash prompt:

$

$ Rscript myTickets.R

The number of tickets issued for parking on a front yard was 5 .

The average fine issued in April was $ 46.26087 .

The second highest state or province to generate tickets was QC .

$ 


Submit your myTickets.R file, and the output of "git log" from your assignment repository, to the 'Assignment Dropbox'.  To capture the output of 'git log' use redirection, as described in lecture 2 (git log > git.log, and hand in the "git.log" file).

Assignments will be graded on a 10 point basis.
Due date is February 3rd 2017 (midnight), with 0.5 penalty point per day off for late submission until the cut-off date of February 10, 2017, at 10:00am.

Last Modified: Tuesday Jan 31, 2017 - 15:04. Revision: 17. Release Date: Thursday Jan 26, 2017 - 20:00.


Content Navigation


Course Calendar


Course Events



Questions? Contact Support.
Web site engine's code is copyright © ATutor®.
Modifications and code of added modules are copyright of SciNet.