---
title: "Lab 2 - Describing and Visualizing Survey Responses"
author: "Your name"
date: "September 28, 2026"
format:
  html:
    theme: cosmo
editor_options:
  chunk_output_type: console
---

```{r setup, include=FALSE}
# DO NOT ALTER CODE IN THIS CHUNK
library(tidyverse)
library(here)
library(scales)

lns <- read_rds(
  here("Labs", "fall2026", "lab1", "output", "lns_clean.rds")
)
```

* * *

# Guided Work

## Exercise 1: Identify variable types

```{r}
class(lns$main_problem)
class(lns$generation)
class(lns$age)
class(lns$poor_work)
class(lns$discrimination_index)
```

[Classify each variable here.]

## Exercise 2: Describe age

```{r}
lns |>
  summarize(
    valid_n = sum(!is.na(age)),
    mean = mean(age, na.rm = TRUE),
    median = median(age, na.rm = TRUE),
    standard_deviation = sd(age, na.rm = TRUE),
    minimum = min(age, na.rm = TRUE),
    maximum = max(age, na.rm = TRUE)
  )
```

```{r}
ggplot(lns, aes(x = age)) +
  geom_histogram(binwidth = 5, color = "white", fill = "#5C8CC6") +
  labs(x = "Age", y = "Number of respondents") +
  theme_minimal()
```

[Describe the distribution here.]

## Exercise 3: Counts and percentages

```{r}
problem_table <- lns |>
  filter(!is.na(main_problem_analysis)) |>
  count(main_problem_analysis, sort = TRUE) |>
  mutate(percent = n / sum(n))

problem_table
```

[Explain the denominator here.]

## Exercise 4: Prepare an ordinal measure

```{r}
# Inspect poor_work and create an ordered analysis version
```

[Enter your response here.]

## Exercise 5: Cross-tabulation

```{r}
# Compare poor_work across generation groups
```

[Enter your interpretation here.]

## Exercise 6: Visualize the comparison

```{r}
# Build the subgroup visualization here
```

[Enter your interpretation here.]

## Exercise 7: Measurement

```{r}
# Inspect the discrimination items and index here
```

[Explain the difference between an item, index, and scale here.]

* * *

# On Your Own

Repeat the workflow using `latino_work`.

## 1. Inspect and recode the measure

```{r}
# Enter your code here
```

## 2. Produce the overall distribution

```{r}
# Enter your code here
```

[Enter your interpretation here.]

## 3. Compare two groups

```{r}
# Enter your code here
```

[Enter your interpretation here.]

## 4. Create a visualization

```{r}
# Enter your code here
```

## 5. Write a concise finding

[Enter your response here.]
