Question: This question is based on sakila database. You will also need the DBI and RMySQL packages, as well as the ggplot 2 package in R
This question is based on sakila database. You will also need the DBI and RMySQL packages, as well as the ggplot package in R
a Write a SQL Query to select paymentid customerid rentalid staffid and amount from the payment table for all customers whose id is smaller than
b Load the results of this query into a data frame pDF in R using the dbGetQuery command similar to what we did in class and assignments Show the RCode.
While you need to create the connection string and run it in R you need not show that code here; it is sufficient to show the R code for dbGetQuery
c Display the top six rows of pDF using the head command. Show the RCode and the Result.
d Plot the histogram of the amount data. Show the RCode and the Result.
e Plot the histogram of amount using the customerid as the facet. Hint: Use the facetwrap feature in ggplot Show the RCode and the Result.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
