## R-code for assignment 1 ## AHW3 ## Feb 5, 2008 ## remove the items in the working memory rm(list = ls()) ## read in the data ## note that I can read in the data directly stored on the website! wheat <- read.table("http://faculty.unlv.edu/westveld/Teaching/Sta713/Data/wheat.txt") yA <- wheat$yA yA yB <- wheat$yB yB ## make the plots ## the pdf() command saves a pdf file directly ## the dev.off() closes the file pdf("fig1.pdf",family="Times",height=5,width=6) par(mfrow=c(2,2)) boxplot(yA, col="yellow") boxplot(yB, col="yellow") plot(yA, yB) ## Does this plot tell us anything in this case? No, yA and yB are not on the same units! hist(c(yA, yB), col="yellow") dev.off() ## subset the data and save it wheatSub <- wheat[3:5,] write.table(wheatSub, "wheatSub.txt")