rm(list=ls()) #make sure the working directory is correct getwd() setwd("C:/Users/aamahama/Desktop/R demo for 528x/") #Next load in the data set from a spreadsheet (excel.csv) rvw<-read.csv("ds 3.csv",header=T) attach(rvw) rvw$env<-as.factor(rvw$env) rvw$rep<-as.factor(rvw$rep) detach(rvw) attach(rvw) plot(mscore,yld,pch=20) yld.allenv<-lm(yld~mscore) abline(yld.allenv) sink("Regr combined.txt") anova(lm(yld~mscore)) summary(lm(yld~mscore)) anova(lm(yld~env + mscore + mscore*env)) summary(lm(yld~env + mscore + mscore*env)) sink() detach(rvw)