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 calves and pens separately from repeated weight records.
data |>
  summarise(
    recorded_calves = n_distinct(calf_id),
    recorded_pens = n_distinct(pen_id)
  )

# Each row below counts the weight records from one pen.
data |> count(pen_id)

# Show the number of follow-up weights for the first six calves.
data |> count(calf_id) |> head(6)

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