data <- scan(what = list(r50="",r21="",aminoacid=0), multi.line=F) no no 1.697 yes no 2.032 no yes 2.211 yes yes 2.091 no no 1.601 yes no 2.017 no yes 1.673 yes yes 2.255 no no 1.830 yes no 2.409 no yes 1.973 yes yes 2.987 data oex8_6 <- data.frame(data) rm(data) oex8_6$r50 <- as.factor(oex8_6$r50) oex8_6$r21 <- as.factor(oex8_6$r21) oex8_6.lm <- lm(aminoacid ~ r50 +r21 +r50:r21, data=oex8_6) anova(oex8_6.lm) # examine the interaction interaction.plot(oex8_6$r50,oex8_6$r21, oex8_6$aminoacid,type="b") # check model assumptions # this code displays all 4 plots on a page x11() par(mfrow=c(2,2)) plot(oex8_6.lm) par(mfrow=c(1,1)) # this code displays just the top 2 plots, on a single page x11() par(mfrow=c(1,2)) plot(oex8_6.lm, which =c(1,2)) par(mfrow=c(1,1)) # this code displays just the top 2 plots, on separate pages x11() plot(oex8_6.lm, which =c(1)) x11() plot(oex8_6.lm, which =c(2))