library("dplyr")

# Student project: import and inspect the unchanged synthetic observations.
# Set the working directory to this case folder, or use run-project.R from root.
# readr imports the CSV; dplyr counts the recorded animals and groups.
data <- readr::read_csv("data.csv")

# Show the number of rows and columns, six example rows, and column types.
dim(data)
head(data, 6)
str(data)

# Count missing (NA) values in each column.
colSums(is.na(data))

# Describe the recorded values without fitting an inferential model.
summary(data)

# Count pens and blocks; diets were assigned to whole pens.
data |>
  summarise(
    recorded_pens = n_distinct(pen_id),
    recorded_blocks = n_distinct(block)
  )

# Count the recorded pens for each diet within each block.
data |> count(block, diet)

# Next: choose a question and submit analysis-plan.qmd in Week 10.
# Create your own analysis script, using class examples for syntax where needed.
