I would like to know how to use the command jitter ...
I've tried something like points(a[1], y=NULL, (jitter(a, factor=1, amount=NULL), pch=20, col="red") but it doesn't work... any idea?
Could you please turn this into a self-contained reprex (short for minimal reproducible example)? It will help us help you if we can be sure we're all working with/looking at the same stuff.
If you run into problems with access to your clipboard, you can specify an outfile for the reprex, and then copy and paste the contents into the forum.
boxplot takes a horizontal parameter, which plots the values along the x axis instead of the y axis. You can plot all your points in one step if you supply a y vector the same length as your values. It's not documented in an obvious way, but the y coordinate for a single horizontal boxplot is 1.
jitter needs to be applied to a vector, so now that the boxplot is horizontal, jitter should be applied to the vector of y values (I boosted the factor here to make the jittering really obvious, but you might want different parameters):
a <- c(5, 15, 10, 7, 9, 11, 13, 9, 10, 12)
# Horizontal boxplot
boxplot(a, ylab = "Explosions", main = "Boxplot", horizontal = TRUE)
# Plot a in one step
points(x = a, y = rep(1, length(a)), pch = 20, col = "blue")
# Plot a with jitter in the y coordinates
points(x = a, y = jitter(rep(1, length(a)), factor = 5), pch = 20, col = "red")