TG = ToothGrowth # Shorten dataset name
TG$supp2 = as.character(TG$supp) # Add character version of supp
png(filename = "illustrations/fig-AII-2-univariate visualization 2.png",
units = "in", # Set measurements in inches
res = 1200, # Set resolution at 1200dpi
width = 6, # Width at 6 inches
height = 4) # Height at 4 inches
par(mfrow=c(1, 2), # Set multiple plots
mai = c(.5, .5, .25, .25)) # Set margins
plot(TG$supp) # For factors just use plot()
boxplot(TG$len) # It doesn't get any easier than this
dev.off() # Output png file
Figure A2-2: Histogram & Boxplot
Portfolio Categories: All Graphics and SGR Book Graphics.