knitr::opts_chunk$set(echo = F,
                      warning = F,
                      message = F,
                      fig.align = "center")

## Load the required package: tidyverse
library(tidyverse)

## Read in the home_sales_sample.csv file as home_sales
home_sales <- read.csv("home_sales_sample.csv")

Data Description

The home_sales data set has the information on 1,000 randomly sampled homes that were sold in 2022. There are six variables (columns):

  1. id: The unique identifier for the home in the data set
  2. sale_date: the date the home went up for sale
  3. town: the town the home is in
  4. assessed_value: The value of the property assessed by the town for tax purposes
  5. sale_amount: How much the home sold for (in $)
  6. residential_type: If the home is a Condo or Single Family

Question 1: Basic GGPlot Scatterplot

Create a scatterplot of the sale_amount by assessed_value with the points colored by residential_type and partially transparent. Add a straight trend line. See what the graph should look like in Brightspace.

Save the graph as gg_q1 and display the graph in the knitted document.

Question 2: Theme and Text

Create the graph seen in question 2 in Brightspace. Save the graph as gg_q2 and display it in the knitted document.

Question 3: Changing axis and colors

Using the graph created in question 2, create the graph seen in Brightspace for question three. The colors used for Condo and Single Family are tomato and steelblue, respectively. Make sure to pay close attention to the axes!

Save the graph as gg_q3 and make sure to display it in the knitted document!

Question 4: Small Multiples

Using gg_q3, create two graphs, one for Condo and one for Single Family, in the same plot. Hide the legend.

Since this is the final question, you don’t need to save the graph