library(foreign)
library(dplyr)
data_URL <- "https://github.com/Jeshua-Romero-Guadarrama/Econoalgoritmia/tree/main/data/fastfood.dta?raw=true"
dat <- read.dta(data_URL)
dat <- dat %>%
mutate(FTE = nmgrs + empft + (0.5 * emppt),
FTE2 = nmgrs2 + empft2 + (0.5 * emppt2))
# generar los subconjuntos
# calcular las medias de grupo
# generar los subconjuntos
dat_NJ <- subset(dat, state == 1)
dat_PA <- subset(dat, state == 0)
# calcular las medias de grupo
dat %>%
group_by(state) %>%
summarise(mean(FTE, na.rm = T),
mean(FTE2, na.rm = T))
ex() %>% check_predefined_objects("dat")
ex() %>% check_object("dat_NJ") %>% check_equal(undefined_msg = "No ha definido `dat_NJ`!")
ex() %>% check_object("dat_PA") %>% check_equal(undefined_msg = "No ha definido `dat_NJ`!")
ex() %>% check_or(
ex() %>% check_output_expr("dat %>%
group_by(state) %>%
summarise(mean(FTE, na.rm = T),
mean(FTE2, na.rm = T))", missing_msg = "Parece que no todos las medias de grupo se han impreso correctamente en la consola."),
ex() %>% check_output_expr("mean(dat_NJ$FTE, na.rm=T);mean(dat_NJ$FTE2, na.rm = T);mean(dat_PA$FTE, na.rm = T);mean(dat_PA$FTE2, na.rm = T)", missing_msg = "Parece que no todos las medias de grupo se han impreso correctamente en la consola.")
)
success_msg(msg = "¡Correcto!")