n <- 500
x <- c(rep("A", n), rep("B", n))
y <- c(rnorm(n), rnorm(n, mean = 5, sd = 3))
group <- sample(1:2, size = 2 * n, replace = TRUE)
plotjit(x, y, pch = 16, jit = .5, alpha.f = .5)
plotjit(x, y, pch = 16, jit = .5, alpha.f = .5,
group = group)
Run the code above in your browser using DataLab