I am trying to construct a t.test using a Hi/Lo method. But I am getting an error, this is my code:
##hi/lo version
dat = read.csv("parking.csv", comment.char = "#", as.is = TRUE)
dat = dat[dat$prepost!="" & !is.na(dat$viol_pc) , ];
dat = dat[, c("wbcode","country","viol_pc", "prepost","corruption")]
dat$hilo = ifelse(dat$corruption > 0.33, "hi", "lo")
pp_hilo = t.test(dat$hilo[dat$prepost=="pre"], dat$hilo[dat$prepost=="pos"])
The error I get is
Error in if (stderr < 10 * .Machine$double.eps * max(abs(mx), abs(my))) stop("data are essentially constant") : missing value where TRUE/FALSE needed