Assignment 3
Learning Objectives
- read and write CSV files
- load and convert dates
- calculate with dates
- summarize date data
Data Files
Tasks
Before diving into the programming problems, study the data files that are provided for the assignment.The files contains dates and related data on birds strikes to aircraft. Each row is a bird strike incident.
- (10 Points) Load the data file "BirdStrikes" into an appropriate data object of your choice. Note that the data file is compressed so you need to determine and appropriate way to uncompress the file, either in the file system or in R.
- (20 Points) Write a function called mostStrikesInaYear() that returns the year which had the most bird strike incidents?
- (20 Points) Write a function called strikesByYear() that returns a dataframe containing for each year the number of bird strike incidents.
- (10 Points) Write a function called strikesByType() that returns the number of birds strike incidents per type of wildlife (excluding unkown) in a dataframe. Store the return result in a dataframe called Strikes.
- (10 Points) Write a function called mostStrikes() that accepts the dataframe Strikes from (4) as an argument and returns the type of wildlife that caused the most bird strike incidents.
- (20 Points) For the function mostStrikes() use system.time() to measure the execution time for the original sized data, 20 times the original size and 40 times the original size, etc. by duplicating the data set (you may need quite large data sets if you have a fast computer). Write a short report that describes your approach and includes a chart that visualizes the runtime curve (you may do the chart in Excel or R). Based on the curve, find the complexity of the function and define big-O. Hint: Consider using the rbind() function to concatenate data frames.
Deliverables & Submission Instructions
You need to submit an .R extension file. Be sure to state all the assumptions and give explanations as comments in the .R file wherever needed to help us assess your submission. Please name the submission file LAST_FirstInitial_3.R for example for John Smith’s assignment, the file should be named Smith_J_3.R. Make sure that whatever you submit works; no credit will be given for code that does not work. Upload the submission to Blackboard. Make sure you follow the R Programming Style Guide.
Scoring
Total Number of Earnable Points: 100
Approximate Time to Complete: 5-7 hours
Due Date: see Calendar or Blackboard
Approximate Time to Complete: 5-7 hours
Due Date: see Calendar or Blackboard