---
title: "Lab Assignment 1"
format: html
editor: visual
author: [Your name here]
---

## Instructions

Welcome to your first lab assignment! Are you excited? I sure am. Please read the following instructions before you begin.

For your lab assignments, you may use AI to help you code. You will be required to explicitly fill out the **SPARCK** framework for each question. You may not use AI to write the non-coding parts of the framework, although you may consult it for assistance.

Generally, your lab assignments will ask you to access a dataset, and then to investigate some questions in regards to the data. These questions will be relatively broad, meaning that you will have some flexibility in *how* exactly you answer them. This is the point, and the benefit of using AI to help you code: We don't need to be worried about walking step by step through an analysis, but can instead think about it from a broader perspective; the specific code you use to tackle the analysis is up to you. The goal is for you to get practice thinking about how to answer a question with data.

As you write code, think about what we've learned in class so far, and especially what we learned in the Data Wrangling/Cleaning tutorial. You don't need to exclusively use functions we used in class, but they should serve as a reminder of the types of things you might wish to do.

You should guide me through the answer the questions. This means you shouldn't just copy and paste code from Gemini and be done with it; your **SPARCK** responses should guide me through your thought process and analysis. You might also wish to spread your code across several different chunks so you can display output along the way if you think that makes it easier to understand.

Remember that you must render your Quarto document into an html file. This html is what you should hand in on Canvas. If you encounter errors, use Gemini to help you troubleshoot!

**Make sure you put this Quarto file in your Week 3 folder, and then open the file from that folder so that R's working directory is your Week 3 folder.**

**S: Set up** (What is your end goal?)

**P: Pseudocode** (What are the steps?)

**A: AI** (What are your AI prompts?)

**R: Run** (Run it!)

**C: Check** (Did your code work?)

**K: Knowledge** (What does your code mean?)

## The data

For today's homework, we are going to be using a dataset from the Prison Policy Initiative about the costs of making phone calls from inside carceral institutions. You can learn more about this project [here](https://www.prisonpolicy.org/phones/state_of_phone_justice_2022.html).

Specifically, we will be using a dataset that tracks phone call rates in over 3,000 jails and other detention facilities across the U.S. in 2021. (Jails are different from prisons. Jails are run by counties and cities and mostly hold people who are awaiting trial and haven't been convicted of a crime, along with people serving short sentences. Prisons are run by states or the federal government and hold people who have been convicted and sentenced, usually to more than a year.) Most facilities in this dataset are jails, but it also includes juvenile detention centers, immigrant detention centers, tribal jails, and a few other types.

For this homework, I have provided you with the dataset. You may download it from either our syllabus website or Canvas. You should place it in the same folder as this document.

## Question 1

Pick one state that is meaningful to you, and give me a sense of the phone rate landscape in that state. Some questions you might wish to answer:

- What is the average cost of making a phone call?

- How much variety is there between facilities?

- Is there a large difference in in-state vs out of state rates?

Remember, *you* are choosing what point you want to get across, and how exactly you want to do it.

**S:**

**P:**

**A:**

**R:**

```{r}

```

(You may insert as many code chunks as you'd like. You can do so by going to Insert \> Executable Cell \> R in the toolbar above.)

**C:**

**K:**

## Question 2

Compare different types of facilities across the whole country. Some questions you might want to answer:

- How many of each are included in this data?

- How do different facilities differ in terms of call rates?

**S:**

**P:**

**A:**

**R:**

```{r}

```

(You may insert as many code chunks as you'd like. You can do so by going to Insert \> Executable Cell \> R in the toolbar above.)

**C:**

**K:**

## Question 3

Compare different carriers/providers. Some questions you might want to answer:

- Do certain states rely more on certain carriers over others?

- Which carriers charge the highest rates?

**S:**

**P:**

**A:**

**R:**

```{r}

```

(You may insert as many code chunks as you'd like. You can do so by going to Insert \> Executable Cell \> R in the toolbar above.)

**C:**

**K:**
