Assignment 4
Learning Objectives
- read and write Excel files
- shape data
Data Files
Tasks
Before diving into the programming problems, study the data file that is provided for the assignment:
- (10 Points) Load the data file into a data frame.
- (60 Points) The opening times of the markets are text. We need to use text analytics to categorize opening times. Create a new column called Open that is set to 1 if the market is open until 12pm only, 2 if it is all day (from some time in the morning to sometime in the afternoon), and 3 if it is afternoon only (only open after 12pm). Ignore cases that do not have a value.
- (20 Points) Write a function openingTimes() that returns a data frame with two columns and three rows: open and number. Each row contains an opening period and the number of markets open during that period.
- (10 Points) Write a function sellsBakedGoods() that calculates the percentage of markets that sell baked good.
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_4.R for example for John Smith’s assignment, the file should be named Smith_J_4.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: 3-4 hours
Due Date: see Calendar or Blackboard
Approximate Time to Complete: 3-4 hours
Due Date: see Calendar or Blackboard