As usual, all code below should follow the style guidelines from the lecture slides.
Use the code below to load the building permits data. You may have to install the required packages.
library(readr)
library(dplyr)
library(tidyr)
permits <- read_csv("https://raw.githubusercontent.com/peteragao/STAT302-AUT2021/base/files/projects/01_data-visualization/Building_Permits_Clean.csv")
Use the filter function to create a new tibble with only permits issued in 2021.
Use the filter function to create a new tibble with only permits issued in 2021 for projects that add at least 1 housing unit.
Use the mutate function to create a new variable is_single_family that is TRUE if the permit is for a single family building.
Use the mutate function and ifelse function to create a new variable north_of_cut that has the value "north" if the permit is for a location in council districts 4, 5, 6, and the value "south" otherwise.
Calculate the number of permits by year using the group_by and summarize functions.
Calculate the number of housing units added by city council district. You may have to figure out what to do with NA values.
Use the filter function to create a new tibble with only permits issued in 2021 for projects that add at least 1 housing unit. Using your new tibble, calculate the average number of housing units added (for projects that add at least 1 housing unit) by city council district.