This chapter first outlines some basic plotting functions that are used in later chapters, then covers some methods by which figures can be enhanced. For the most part, graphing functions used in this chapter belong to package graphics or package grDevices . Before beginning, clear the workspace and the console and generate some
data to use in the illustrations presented in this chapter. Enter the following code in the script editor and run it. Lines beginning with the “#” symbol are comments lines, added for explanation
#Generate a random sample in three groups
#Create a variable to identify groups in y
G-factor(c(rep(1,500),rep(2,350),rep(3,700))) To make the data sound more interesting, suppose the data represent weights King
y and G in a data frame and then remove y and G from the workspace.