data(cushny)
plot(cushny, rep(0, 10), pch = 3, cex = 3,
ylab = "", yaxt = "n")
plot(jitter(cushny), rep(0, 10), pch = 3, cex = 2,
main = "'cushny' data (n= 10)", ylab = "", yaxt = "n")
abline(h=0, col="gray", lty=3)
myPt <- function(m, lwd = 2, ..., e = 1.5*par("cxy")[2])
segments(m, +e, m, -e, lwd = lwd, ...)
myPt( mean(cushny), col = "pink3")
myPt(median(cushny), col = "light blue")
legend("topright", c("mean", "median"), lwd = 2,
col = c("pink3", "light blue"), inset = .01)
## The 'sleep' data from the standard 'datasets' package:
d.sleep <- local({ gr <- with(datasets::sleep, split(extra, group))
gr[[2]] - gr[[1]] })
stopifnot(all.equal(cushny,
sort(d.sleep), tolerance=1e-15))
Run the code above in your browser using DataLab