if (require(AER)) {
data("NMES1988", package="AER")
nmes <- NMES1988[, c(1, 6:8, 13, 15, 18)]
plot(log(visits+1) ~ cutfac(chronic),
data = nmes,
ylab = "Physician office visits (log scale)",
xlab = "Number of chronic conditions", main = "chronic")
plot(log(visits+1) ~ cutfac(hospital, c(0:2, 8)),
data = nmes,
ylab = "Physician office visits (log scale)",
xlab = "Number of hospital stays", main = "hospital")
}
data("CrabSatellites", package = "vcdExtra")
# jittered scatterplot
plot(jitter(satellites) ~ width, data=CrabSatellites,
ylab="Number of satellites (jittered)",
xlab="Carapace width",
cex.lab=1.25)
with(CrabSatellites,
lines(lowess(width, satellites), col="red", lwd=2))
# boxplot, using deciles
plot(satellites ~ cutfac(width), data=CrabSatellites,
ylab="Number of satellites",
xlab="Carapace width (deciles)")
Run the code above in your browser using DataLab