ABSTRACT

To illustrate basic methods for creating graphs in R in the graphics package, consider all the career batting statistics for the current members of the Hall of Fame. There are two fundamental data types – measurement and categorical – which are represented in R as numeric and factor variables. Using the traditional graphics package of R, it is easy to modify the attributes of a graph by adding labels and changing the style of plotting symbols and lines. The chapter describes graphs for a single factor variable and a single numeric variable, and then describe graphical displays helpful for understanding relationships between the variables. A modern method of displaying labeled data is a dot plot, introduced by William Cleveland. Dot plots can be used to display any collection of labeled numeric data. The plot function constructs a graph of the cumulative home run count against the date.