set.seed(1)
DF <- data.frame("Y" = rnorm(100))
DF$D <- ifelse(DF$Y > 0, 1, 0)
# compute group-specific sample means of `Y`
# regress `Y` on `D`
mu_Y_D1 <- mean(DF$Y[DF$D ==1])
mu_Y_D0 <- mean(DF$Y[DF$D ==0])
lm(Y ~ D, data = DF)
test_object("mu_Y_D1")
test_object("mu_Y_D1")
test_or(
{
test_function("lm", args = "formula")
},{
ex() %>% override_solution("lm(DF$Y ~ DF$D)") %>% check_function("lm") %>% check_arg("formula")
}
)