Query Databases and Data frames in R with SQLThe link is for database files:https://drive.google.com/file/d/1m7i0qF0HPVyuwx5Wk…ResourcesFirst Steps in RLecture Notes on R and ExamplesQuerying Data Frames in R with SQL using sqldfInstructionsCreate an R Notebook and do the following tasks in separate code chunks:1. (20 pts) In the R Notebook, connect to the SQLite MediaDB.db(https://northeastern.instructure.com/courses/80530/files/9239221/download?download_frd=1)database and then load, using SQL SELECT, the “invoice_items” table into a data frame called rs.Add a new column to rs for the extended price called ExtPrice that is Quantity times Price. UsingR, what is the average extended price (rounded to 2 decimals)? Do not use {sql} chunks for this.2. (30 pts) Using sqldf, write a SQL query against the data frame rs from the question above thatfinds the total amount for each invoice (i.e., the sum of the extended prices for the invoice_itemsin each invoice) and the number of items in the invoice. So, the result set contains rows that eachhave the invoice ID, the total, and the number of items.3. (30 pts) Using R and the result from the prior question, create a scatter plot of the total number ofitems in an invoice (x axis) versus the total (y axis). Add proper axis labels.4. (20 pts) Write and execute a SQL UPDATE statement that applies a 10% discount to the totalamount for each invoice if it has more than 5 items and stores that discounted amount in a newcolumn called DiscPrice. Using a separate {r} chunk show that the query executed properly by2021/6/17 [90 min] DO: Assignment 5 / Query Databases and Dataframes in R with SQL2/2displaying a part of the table. If you cannot use sqldf, then apply to the database directly instead;either are acceptable as long as you use a SQL UPDATE.Requirements: no | R
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more