PROGRAMMING FOR ANALYTICS DNSC-4211 Programming for Analytics Mid-Term (Fall 2019) Date: xx/xx/2019 Time: 1 hours, 15 mins THIS IS SAMPLE MID TERM FILE FROM PREVIOUS SEMESTER INSTRUCTIONS FOR STUDENTS: Duration: 1 hours 15 mins. Keep at least 05 mins buffer to upload the correct files/folder on blackboard The mid exam is INDIVIDUAL There are five questions, answer all questions. Save individual files (Total 5 working files, read the instruction given with each question) in a folder. Name the folder with your GWid (), zip the folder and upload it on blackboard Student can use/access the resources/materials from blackboard only and notes Assume missing information and mention it explicitly in code as comments. Cell phones, chat option, use of google are not allowed. If you are observed with any of the mentioned options or in sight, you will receive a grade of ZERO on the midterm exam. Upload your midterm file folder using the link: Upload Mid-Term files folder here: $ALL THE BEST$ 1. Creating functions and plots [20 points] In a single R file or a single R markdown file, name the file as ‘answer1.R’ or ‘answer1.RMD’ Task1: Write a function to counts the number of odd integers in vector OR Task1: Use iris dataset and create a scatter plot between Sepal width ~ Sepal length 2. Loops: for-loop and while-loops, loop inside loop [20 points] In a single R file or a single R markdown file, name the file as ‘answer2.R’ or ‘answer2.RMD’ Task1: Create a list that contains the following values: 10,24,100,56,49. Write a for-loop that only prints out the numbers which are larger than 50 OR Task1: Create a list that contains the following letters: d,a,t,a,s,c,i,e,n,c,e. Write a for-loop that only prints out the letters that are vowels (e.g., o,u,a,e,i) PROGRAMMING FOR ANALYTICS 3. Linear regression with interpretation [20 points] In a single R file or a single R markdown file, name the file as ‘answer3.R’ or ‘answer3.RMD’ Read the file blackboard (mid-term folder): basketball2.csv Run two linear regressions. One for the players with active_or_retired equal to 0 (the retired players) and one for players with active_or_retired equal to 1 (the active players). In both regressions, the dependent variable is salary/income, and the independent variables are played_games/games, scored_points/points, and played_minutes/minutes. Write a code and answer the following question (max one of two lines) Task1: Interpret the result of linear regressions 4. Data wrangling and ggplot [20 points] In a single R file or a single R markdown file, name the file as ‘answer4.R’ or ‘answer4.RMD’ Part(a) Read the file blackboard (mid-term folder): market.csv Write a code and answer the following question Task1. Create new columns ‘log_sales’ data frame using a natural logarithm of SalesInThousands. Part(b) Read the file blackboard (mid-term folder): wine.csv Write a code and answer the following question Task1: Plot box graph between ‘sulphates’ and ‘quality’ variables PROGRAMMING FOR ANALYTICS 5. Shiny App [20 points] If you are using a single file ‘app.R’, save it in folder and name it folder as ‘asnwer5’ If you are using ‘ui.R’ and ‘server.R’, save it in folder and name it folder as ‘asnwer5’ Create a shiny app using ‘iris data set’ which will display the graphics(graph) for the selected species (based on Sepal. Length, Sepal. Width and Petal. Length, Petal. Width. Anticipated Output: