# ferdo R Lab - Ders 2 (v1.0): student exercises
# Do not change the original CSV. Fill in the TODO lines independently.
stopifnot(file.exists("data/class_synthetic.csv"))
class_data <- read.csv("data/class_synthetic.csv",
                       na.strings=c("", "NA"), stringsAsFactors=FALSE)
class_data$group <- factor(class_data$group,levels=c("A","B"))

# 1) Use nrow(), ncol(), str() to inspect the dataset.
# TODO:

# 2) Keep only group A rows.
# TODO:

# 3) Keep rows where quiz_score >= 70, excluding missing scores safely.
# TODO:

# 4) Make a new table with only student_id and quiz_score columns.
# TODO:

# 5) Count missing study_hours and quiz_score values separately.
# TODO:

# 6) Count complete pairs of study_hours and quiz_score.
# TODO:

# 7) Calculate the mean quiz_score separately for groups A and B.
# TODO:

# 8) On a COPY, replace one quiz_score with NA; compare means.
# TODO:

# 9) Make a table of group B rows with observed quiz scores,
#    find its row count and mean score, and IDs with quiz_score > 75.
# TODO:

# 10) Explain why missingness might bias an analysis, and why
#     an observed association does not establish causation.
