# put Howell's data into more convenient form for the homework # read the data # assumes you've downloaded the data files into current dir phonedat <-read.delim2("Ex11-32.dat") gluclat <-read.delim2("Ex12-22.dat") trials2learn <-read.delim2("Ex12-1.dat") # First do the driving data # change from the data-in-separate columns format into the # the standard each-row-is-an-observation format; omit the # unecessary id column phonedat <- stack(phonedat, select = -id) # first column is now the measured values (steering errors) # and second col. is the condition (alcohol., cell phone, or control) # work on the rat learning data # these data come with a "Group" column with the numbers 1 through 5 indicating # treatment groups - we'll create a new column that is a "factor" (for the anova) and # that has more descriptive names mylevels = c('control1', 'control2', 'nofood', 'nowater', 'nofoodorwater') # make these labels into an official "factor" myfactor <- factor(trials2learn$Group, labels=mylevels) # add factor to the data frame trials2learn$GroupName <- myfactor # now do the latency vs. glucose data # make vector containing doses - these are from memory, so might be wrong myvals = c(0, 1, 10, 100, 250, 500) # make a vector with 6 of each myvals <- rep(myvals, each=6) # and put into a new "doses" column of our data frame gluclat$doses <- myvals # save into an easily-loadable R workspace file save(gluclat, phonedat, trials2learn, file = "myHWdata.Rdata") #say "woohoo" print('woo hoo')