set.seed(1) DF <- data.frame("Y" = rnorm(100)) DF$D <- ifelse(DF$Y > 0, 1, 0) # calcular las medias muestrales específicas del grupo de "Y" # regreso `Y` en `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") } )