ABSTRACT

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 [56]. 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

y-c(round(rnorm(500,25,8),1), round(rnorm(350,15,4.5),1),round(rnorm(700,7,2.1),1))

#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.