Assignment 5 Overview This assignment allows us to run an analysis from beginning to end. We will extract data from the textbook database using MySQL Workbench, import the data into RStudio, and creat

Assignment 5

1. Start RStudio and import the data.

2. Download and install the dplyr package by issuing the following commands:

Install.packages(“dplyr”)
library(dplyr)

3. Then download and install the ggplot2 package:

Install.packages(“ggplot2”)
library(ggplot2)

4. Assuming you have already followed the instructions in chapter 7 and imported the data into RStudio, create a scatterplot with the following commands. Note that the frame names need to be the same as in the chapter.

p1plot <- ggplot(drg2018_s50_fusion, aes(x=total_discharges_s, y=paymentdiff_s))

p1plot + geom_point(size=3)

5. Copy the plot into a Word file and answer the question, “Does there appear to be a correlation?”

6. Then to verify your visual impression, perform a correlation test. To calculate a correlation in RStudio, you can use the cor() function.

7. To run the correlation, create a frame A5 with just the variables total_discharges_s and paymentdiff_s. Then run the following command: cor(A5)

8. Copy the correlation into your Word file and interpret it. What is the correlation between payments and discharges? Does it confirm your impression from the scatterplot?

9. Save your Word file and upload to the classroom.