Although plot() can produce bar charts, the barplot() function is often more convenient. In this video we introduce this function and illustrate its use to produce bar charts that display one and two-way frequency distributions and to produce bar charts that display a statistic (e.g., a mean) by group. In th latter case we also illustrate how to add whiskers to each bar to display a standard error or confidence interval that reflects the uncertainty in the sample statistic as an estimator of a corresponding population quantity. Adding whiskers/standard error bars to a bar chart can be tricky, but is easier with the barplot2() function of the gplots package. This video also gives tips on how to make space for a legend and how to improve its configuration and placement in a plot. Examples in this video are drawn from Mod12Script.R. You should open
this script in RStudio and follow along, reading and submitting code as
you watch the video.
This video is essential viewing.