# ferdo R Lab | Lesson 3 | Data setup test (base R)
stopifnot(file.exists("data/class_synthetic.csv"))
d <- read.csv("data/class_synthetic.csv",
              na.strings=c("","NA"), stringsAsFactors=FALSE)
d$group <- factor(d$group, levels=c("A","B"))
stopifnot(
  identical(dim(d),c(12L,4L)),
  length(unique(d$student_id))==12L,
  identical(as.integer(table(d$group)),c(6L,6L)),
  sum(is.na(d$quiz_score))==1L,
  sum(is.na(d$study_hours))==1L,
  sum(complete.cases(d[,c("study_hours","quiz_score")]))==10L
)
cat("R LAB LESSON 3 SETUP CHECK PASS\n")
